Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::IdentityN
#include <array_ops.h>
Returns a list of tensors with the same shapes and contents as the input.
Summary
tensors.
This op can be used to override the gradient for complicated functions. For example, suppose y = f(x) and we wish to apply a custom function g for backprop such that dx = g(dy). In Python,
with tf.get_default_graph().gradient_override_map(
{'IdentityN': 'OverrideGradientWithG'}):
y, _ = identity_n([f(x), x])
.RegisterGradient('OverrideGradientWithG')
def ApplyG(op, dy, _):
return [None, g(dy)] # Do not backprop to f(x).
Args:
Returns:
OutputList
: The output tensor.
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 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tensorflow::ops::IdentityN Class Reference\n\ntensorflow::ops::IdentityN\n==========================\n\n`#include \u003carray_ops.h\u003e`\n\nReturns a list of tensors with the same shapes and contents as the input.\n\nSummary\n-------\n\ntensors.\n\nThis op can be used to override the gradient for complicated functions. For example, suppose y = f(x) and we wish to apply a custom function g for backprop such that dx = g(dy). In Python,\n\n\n```scdoc\nwith tf.get_default_graph().gradient_override_map(\n {'IdentityN': 'OverrideGradientWithG'}):\n y, _ = identity_n([f(x), x])\n```\n\n\u003cbr /\u003e\n\n\n```gas\n.RegisterGradient('OverrideGradientWithG')\ndef ApplyG(op, dy, _):\n return [None, g(dy)] # Do not backprop to f(x).\n```\n\n\u003cbr /\u003e\n\nArgs:\n\n- scope: A [Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n\n\u003cbr /\u003e\n\nReturns:\n\n- `OutputList`: The output tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [IdentityN](#classtensorflow_1_1ops_1_1_identity_n_1a6643cba5b78cac36cc7b45f5e6ac03be)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::InputList](/versions/r2.14/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` input)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_identity_n_1aab1042fbd2a1eb89667e580c77cda3db) | [Operation](/versions/r2.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_identity_n_1adcada4788c180a31ade058caf543a8ce) | `::`[tensorflow::OutputList](/versions/r2.14/api_docs/cc/group/core#group__core_1gab449e6a3abd500c2f4ea93f9e89ba96c) |\n\n| ### Public functions ||\n|----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operator[]](#classtensorflow_1_1ops_1_1_identity_n_1ab03e879700560bb229b66d06d1bccc71)`(size_t index) const ` | `::`[tensorflow::Output](/versions/r2.14/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\n\n```text\n::tensorflow::OutputList output\n``` \n\nPublic functions\n----------------\n\n### IdentityN\n\n```gdscript\n IdentityN(\n const ::tensorflow::Scope & scope,\n ::tensorflow::InputList input\n)\n``` \n\n### operator\\[\\]\n\n```gdscript\n::tensorflow::Output operator[](\n size_t index\n) const \n```"]]