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
.
Arguments:
- 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.
Last updated 2020-04-20 UTC.
[null,null,["Last updated 2020-04-20 UTC."],[],[],null,["# tensorflow::ops::Switch Class Reference\n\ntensorflow::ops::Switch\n=======================\n\n`#include \u003ccontrol_flow_ops.h\u003e`\n\nForwards `data` to the output port determined by `pred`.\n\nSummary\n-------\n\nIf `pred` is true, the `data` input is forwarded to `output_true`. Otherwise, the data goes to `output_false`.\n\nSee also [RefSwitch](/versions/r1.15/api_docs/cc/class/tensorflow/ops/ref-switch#classtensorflow_1_1ops_1_1_ref_switch) and [Merge](/versions/r1.15/api_docs/cc/class/tensorflow/ops/merge#classtensorflow_1_1ops_1_1_merge).\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/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\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_false: If `pred` is false, data will be forwarded to this output.\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_true: If `pred` 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/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` data, ::`[tensorflow::Input](/versions/r1.15/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/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output_false](#classtensorflow_1_1ops_1_1_switch_1a806a04c10d9920f2f1f3b9b503d24a5c) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_true](#classtensorflow_1_1ops_1_1_switch_1a84ad96bc82bdb0ce2af402225707ca0e) | `::`[tensorflow::Output](/versions/r1.15/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```"]]