جریان تنسور:: عملیات:: PreventGradient
#include <array_ops.h>
یک عملیات هویتی که در صورت درخواست گرادیان، خطا را ایجاد می کند.
خلاصه
هنگامی که در یک نمودار اجرا می شود، این op تانسور ورودی خود را همانطور که هست خروجی می دهد.
هنگام ساخت عملیات برای محاسبه گرادیان، سیستم گرادیان TensorFlow هنگام تلاش برای جستجوی گرادیان این عملیات، خطایی را برمیگرداند، زیرا هیچ گرادیانی نباید برای این تابع ثبت شود. این عملیات برای جلوگیری از بازگرداندن بیصدا باگهای ظریف شیبهای اجرا نشده در برخی موارد گوشه وجود دارد.
استدلال ها:
- scope: یک شی Scope
- ورودی: هر تانسوری
ویژگی های اختیاری (به Attrs
مراجعه کنید):
- پیام: زمانی که هر کسی سعی کند این عملیات را متمایز کند با خطا چاپ خواهد شد.
برمی گرداند:
توابع استاتیک عمومی |
---|
Message (StringPiece x) | |
صفات عمومی
عملیات
Operation operation
خروجی
::tensorflow::Output output
توابع عمومی
PreventGradient
PreventGradient(
const ::tensorflow::Scope & scope,
::tensorflow::Input input
)
PreventGradient
PreventGradient(
const ::tensorflow::Scope & scope,
::tensorflow::Input input,
const PreventGradient::Attrs & attrs
)
گره
::tensorflow::Node * node() const
operator::tensorflow::Input() const
عملگر::tensorflow::خروجی
operator::tensorflow::Output() const
توابع استاتیک عمومی
پیام
Attrs Message(
StringPiece x
)
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-26 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-26 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# tensorflow::ops::PreventGradient Class Reference\n\ntensorflow::ops::PreventGradient\n================================\n\n`#include \u003carray_ops.h\u003e`\n\nAn identity op that triggers an error if a gradient is requested.\n\nSummary\n-------\n\nWhen executed in a graph, this op outputs its input tensor as-is.\n\nWhen building ops to compute gradients, the TensorFlow gradient system will return an error when trying to lookup the gradient of this op, because no gradient must ever be registered for this function. This op exists to prevent subtle bugs from silently returning unimplemented gradients in some corner cases.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: any tensor.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/prevent-gradient/attrs#structtensorflow_1_1ops_1_1_prevent_gradient_1_1_attrs)):\n\n- message: Will be printed in the error when anyone tries to differentiate this operation.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): the same input tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [PreventGradient](#classtensorflow_1_1ops_1_1_prevent_gradient_1a0b9966e0dc996fe02edcdfc60584d033)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input)` ||\n| [PreventGradient](#classtensorflow_1_1ops_1_1_prevent_gradient_1ae19edcd4e91e9dc4bc39684dfd8cfa74)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, const `[PreventGradient::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/prevent-gradient/attrs#structtensorflow_1_1ops_1_1_prevent_gradient_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_prevent_gradient_1a9b6a878872406f077395172368112563) | [Operation](/versions/r2.0/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_prevent_gradient_1a4c8f001d1b1f87090e63ed718977d582) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|----------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_prevent_gradient_1a039d4498a7fd50b84e4246f6adab399e)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_prevent_gradient_1a20ebe0054ff4d6f2d7bb35242547bb7b)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_prevent_gradient_1a2e068c7e108d2325da28edbfd997cd02)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|\n| [Message](#classtensorflow_1_1ops_1_1_prevent_gradient_1a5e4b110d0c0f8f247fd80301b88df40d)`(StringPiece x)` | [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/prevent-gradient/attrs#structtensorflow_1_1ops_1_1_prevent_gradient_1_1_attrs) |\n\n| ### Structs ||\n|--------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::PreventGradient::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/prevent-gradient/attrs) | Optional attribute setters for [PreventGradient](/versions/r2.0/api_docs/cc/class/tensorflow/ops/prevent-gradient#classtensorflow_1_1ops_1_1_prevent_gradient). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### PreventGradient\n\n```gdscript\n PreventGradient(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input\n)\n``` \n\n### PreventGradient\n\n```gdscript\n PreventGradient(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n const PreventGradient::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Message\n\n```text\nAttrs Message(\n StringPiece x\n)\n```"]]