Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::
ops::
Switch
#include <control_flow_ops.h>
Forwards
data
to the output port determined by
pred
.
Summary
If
pred
is true, the
data
input is forwarded to
output_true
. Otherwise, the data goes to
output_false
.
See also
RefSwitch
and
Merge
.
Args:
-
scope: A
Scope
object
-
data: The tensor to be forwarded to the appropriate output.
-
pred: A scalar that specifies which output port will receive data.
Returns:
-
Output
output_false: If
pred
is false, data will be forwarded to this output.
-
Output
output_true: If
pred
is true, data will be forwarded to this output.
Public attributes
Public functions
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2021-08-16 UTC.
[null,null,["Last updated 2021-08-16 UTC."],[],[],null,["# tensorflow::ops::Switch Class Reference\n\ntensorflow::\nops::\nSwitch\n=========================\n\n`\n#include \u003ccontrol_flow_ops.h\u003e\n`\n\n\nForwards\n`\ndata\n`\nto the output port determined by\n`\npred\n`\n.\n\nSummary\n-------\n\n\nIf\n`\npred\n`\nis true, the\n`\ndata\n`\ninput is forwarded to\n`\noutput_true\n`\n. Otherwise, the data goes to\n`\noutput_false\n`\n.\n\n\nSee also\n`\n`[RefSwitch](/versions/r2.6/api_docs/cc/class/tensorflow/ops/ref-switch#classtensorflow_1_1ops_1_1_ref_switch)`\n`\nand\n`\n`[Merge](/versions/r2.6/api_docs/cc/class/tensorflow/ops/merge#classtensorflow_1_1ops_1_1_merge)`\n`\n.\n\n\nArgs:\n\n- scope: A [Scope](/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- data: The tensor to be forwarded to the appropriate output.\n- pred: A scalar that specifies which output port will receive data.\n\n\u003cbr /\u003e\n\n\nReturns:\n\n- `\n `[Output](/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` output_false: If `\n pred\n ` is false, data will be forwarded to this output.\n- `\n `[Output](/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` output_true: If `\n pred\n ` is true, data will be forwarded to this output.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| ` `[Switch](#classtensorflow_1_1ops_1_1_switch_1aaf5ed723a26cd3b4c917701508ff4c50)` (const :: `[tensorflow::Scope](/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, :: `[tensorflow::Input](/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` data, :: `[tensorflow::Input](/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` pred) ` ||\n\n| ### Public attributes ||\n|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|\n| ` `[operation](#classtensorflow_1_1ops_1_1_switch_1a6cf3e40f6e518afc71bad3f6a394199a)` ` | ` `[Operation](/versions/r2.6/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation)` ` |\n| ` `[output_false](#classtensorflow_1_1ops_1_1_switch_1a806a04c10d9920f2f1f3b9b503d24a5c)` ` | ` :: `[tensorflow::Output](/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)` ` |\n| ` `[output_true](#classtensorflow_1_1ops_1_1_switch_1a84ad96bc82bdb0ce2af402225707ca0e)` ` | ` :: `[tensorflow::Output](/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)` ` |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output_false\n\n```scdoc\n::tensorflow::Output output_false\n``` \n\n### output_true\n\n```scdoc\n::tensorflow::Output output_true\n``` \n\nPublic functions\n----------------\n\n### Switch\n\n```gdscript\n Switch(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input data,\n ::tensorflow::Input pred\n)\n```"]]