Scope
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
টেনসরফ্লো অপারেশন তৈরি করার সময় সম্পর্কিত বৈশিষ্ট্যের গ্রুপ পরিচালনা করে, যেমন একটি সাধারণ নাম উপসর্গ।
Scope
হল TensorFlow Ops-এ প্রয়োগ করা সাধারণ বৈশিষ্ট্যগুলির জন্য একটি ধারক। সাধারণ ব্যবহারকারী কোড একটি Scope
শুরু করে এবং এটি অপারেশন বিল্ডিং ক্লাসে প্রদান করে। যেমন:
Scope scope = new Scope(graph);
Constant c = Constant.create(scope, 42);
একটি অপারেশন বিল্ডিং ক্লাস একটি স্কোপ অর্জন করে এবং অন্তর্নিহিত টেনসরফ্লো অপারেশনগুলিতে বৈশিষ্ট্য সেট করতে এটি ব্যবহার করে। যেমন:
// An operator class that adds a constant.
public class Constant {
public static Constant create(Scope scope, ...) {
scope.graph().opBuilder(
"Const", scope.makeOpName("Const"))
.setAttr(...)
.build()
...
}
}
স্কোপ অনুক্রম:
একটি Scope
বিভিন্ন with()
পদ্ধতি প্রদান করে যা একটি নতুন সুযোগ তৈরি করে। নতুন স্কোপে সাধারণত একটি সম্পত্তি পরিবর্তিত হয় যখন অন্যান্য বৈশিষ্ট্যগুলি মূল সুযোগ থেকে উত্তরাধিকার সূত্রে প্রাপ্ত হয়।
Constant
ব্যবহার করে একটি উদাহরণ আগের মত প্রয়োগ করা হয়েছে:
Scope root = new Scope(graph);
// The linear subscope will generate names like linear/...
Scope linear = Scope.withSubScope("linear");
// This op name will be "linear/W"
Constant.create(linear.withName("W"), ...);
// This op will be "linear/Const", using the default
// name provided by Constant
Constant.create(linear, ...);
// This op will be "linear/Const_1", using the default
// name provided by Constant and making it unique within
// this scope
Constant.create(linear, ...);
স্কোপ বস্তু থ্রেড-নিরাপদ নয় ।
উত্তরাধিকারসূত্রে প্রাপ্ত পদ্ধতি
java.lang.Object ক্লাস থেকে বুলিয়ান | সমান (অবজেক্ট arg0) |
চূড়ান্ত ক্লাস<?> | getClass () |
int | হ্যাশকোড () |
চূড়ান্ত শূন্যতা | অবহিত করুন () |
চূড়ান্ত শূন্যতা | সকলকে অবহিত করুন () |
স্ট্রিং | toString () |
চূড়ান্ত শূন্যতা | অপেক্ষা করুন (দীর্ঘ arg0, int arg1) |
চূড়ান্ত শূন্যতা | অপেক্ষা করুন (দীর্ঘ arg0) |
চূড়ান্ত শূন্যতা | অপেক্ষা করুন () |
পাবলিক কনস্ট্রাক্টর
একটি নতুন শীর্ষ-স্তরের সুযোগ তৈরি করুন।
পরামিতি
env | স্কোপ দ্বারা কার্যকরী পরিবেশ ব্যবহার করা হয়। |
---|
পাবলিক পদ্ধতি
প্রদত্ত বিল্ডারকে নিয়ন্ত্রণ ইনপুট হিসাবে নিয়ন্ত্রণ নির্ভরতায় প্রতিটি অপারেন্ড যোগ করে।
পরামিতি
নির্মাতা | OperationBuilder এ কন্ট্রোল ইনপুট যোগ করতে |
---|
এই সুযোগ দ্বারা ব্যবহৃত কার্যকরী পরিবেশ প্রদান করে।
সর্বজনীন স্ট্রিং makeOpName (স্ট্রিং ডিফল্ট নাম)
প্রয়োজনে প্রদত্ত ডিফল্ট ব্যবহার করে একটি অপারেটরের জন্য একটি অনন্য নাম তৈরি করুন।
এটি সাধারণত শুধুমাত্র অপারেটর বিল্ডিং ক্লাস দ্বারা বলা হয়।
এই পদ্ধতিটি একটি অনন্য নাম তৈরি করে, এই উদাহরণ দ্বারা নিয়ন্ত্রিত নামের সুযোগের জন্য উপযুক্ত। সাধারণ অপারেটর বিল্ডিং কোড এর মত দেখতে হতে পারে
scope.env().opBuilder("Const", scope.makeOpName("Const"))...
দ্রষ্টব্য: আপনি যদি একটি কম্পোজিট অপারেটর বিল্ডিং ক্লাস প্রদান করেন (অর্থাৎ, একটি ক্লাস যা অন্যান্য অপারেটর বিল্ডিং কোড কল করে সম্পর্কিত ক্রিয়াকলাপের একটি সেট তৈরি করে), প্রদত্ত নামটি সমস্ত অন্তর্নিহিত অপারেটরের জন্য একটি সাবস্কোপ হিসাবে কাজ করবে৷
পরামিতি
ডিফল্ট নাম | অন্তর্নিহিত অপারেটরের নাম। |
---|
রিটার্নস
- অপারেটরের জন্য অনন্য নাম।
নিক্ষেপ করে
অবৈধ আর্গুমেন্ট ব্যতিক্রম | যদি ডিফল্ট নামটি অবৈধ হয়। |
---|
কন্ট্রোল ডিপেনডেন্সির সাথে পাবলিক স্কোপ (Iterable< Operand <?>> কন্ট্রোল)
একটি নতুন সুযোগ প্রদান করে যেখানে যোগ করা অপারেশনগুলিতে প্রদত্ত নিয়ন্ত্রণ নির্ভরতা থাকবে।
এই সুযোগের সাথে তৈরি করা অপারেশনগুলিতে প্রদত্ত নিয়ন্ত্রণগুলির প্রতিটি থেকে একটি নিয়ন্ত্রণ প্রান্ত থাকবে। অন্যান্য সমস্ত বৈশিষ্ট্য বর্তমান সুযোগ থেকে উত্তরাধিকারসূত্রে প্রাপ্ত।
পরামিতি
নিয়ন্ত্রণ করে | প্রত্যাবর্তিত সুযোগের সাথে তৈরি করা অপারেশনগুলির জন্য নিয়ন্ত্রণ নির্ভরতা |
---|
রিটার্নস
- প্রদত্ত নিয়ন্ত্রণ নির্ভরতা সহ একটি নতুন সুযোগ
সর্বজনীন স্কোপ উইথ নেম (স্ট্রিং অপনাম)
একটি নতুন সুযোগ ফিরিয়ে দিন যা একটি অপের জন্য প্রদত্ত নাম ব্যবহার করে।
এই সুযোগের মধ্যে তৈরি করা ক্রিয়াকলাপগুলির একটি নাম থাকবে ফর্ম name/opName[_suffix]
। এটি আপনাকে একটি নির্দিষ্ট অপারেটরের নাম আরও অর্থপূর্ণ করতে দেয়।
নাম অবশ্যই রেগুলার এক্সপ্রেশনের সাথে মিলতে হবে [A-Za-z0-9.][A-Za-z0-9_.\-]*
পরামিতি
opName | প্রত্যাবর্তিত সুযোগে একটি অপারেটরের নাম |
---|
রিটার্নস
- একটি নতুন স্কোপ যা অপারেশনের জন্য opName ব্যবহার করে।
নিক্ষেপ করে
অবৈধ আর্গুমেন্ট ব্যতিক্রম | যদি নামটি অবৈধ হয় |
---|
সাবস্কোপ সহ সর্বজনীন স্কোপ (স্ট্রিং চাইল্ডস্কোপনাম)
একটি নতুন সুযোগ প্রদান করে যেখানে যোগ করা ক্রিয়াকলাপের প্রদত্ত নামের উপসর্গ থাকবে।
এই সুযোগের সাথে তৈরি করা অপ্সের name/childScopeName/
উপসর্গ হিসেবে থাকবে। প্রত্যাবর্তিত সুযোগে আসল নামটি অনন্য হবে। অন্যান্য সমস্ত বৈশিষ্ট্য বর্তমান সুযোগ থেকে উত্তরাধিকারসূত্রে প্রাপ্ত।
চাইল্ড স্কোপের নাম অবশ্যই রেগুলার এক্সপ্রেশনের সাথে মিলতে হবে [A-Za-z0-9.][A-Za-z0-9_.\-]*
পরামিতি
চাইল্ডস্কোপের নাম | নতুন সন্তানের সুযোগের জন্য নাম |
---|
নিক্ষেপ করে
অবৈধ আর্গুমেন্ট ব্যতিক্রম | যদি নামটি অবৈধ হয় |
---|
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক। কিছু কন্টেন্ট NumPy লাইসেন্স-এর অধীনে লাইসেন্স প্রাপ্ত।
2025-07-26 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-26 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Scope\n\npublic final class **Scope** \nManages groups of related properties when creating Tensorflow Operations, such as a common name\nprefix.\n\nA `Scope` is a container for common properties applied to TensorFlow Ops. Normal user\ncode initializes a `Scope` and provides it to Operation building classes. For example:\n\n Scope scope = new Scope(graph);\n Constant c = Constant.create(scope, 42);\n \nAn Operation building class acquires a Scope, and uses it to set properties on the underlying\nTensorflow ops. For example:\n\n // An operator class that adds a constant.\n public class Constant {\n public static Constant create(Scope scope, ...) {\n scope.graph().opBuilder(\n \"Const\", scope.makeOpName(\"Const\"))\n .setAttr(...)\n .build()\n ...\n }\n }\n \n**Scope hierarchy:**\n\nA `Scope` provides various `with()` methods that create a new scope. The new scope\ntypically has one property changed while other properties are inherited from the parent scope.\n\nAn example using `Constant` implemented as before:\n\n Scope root = new Scope(graph);\n\n // The linear subscope will generate names like linear/...\n Scope linear = Scope.withSubScope(\"linear\");\n\n // This op name will be \"linear/W\"\n Constant.create(linear.withName(\"W\"), ...);\n\n // This op will be \"linear/Const\", using the default\n // name provided by Constant\n Constant.create(linear, ...);\n\n // This op will be \"linear/Const_1\", using the default\n // name provided by Constant and making it unique within\n // this scope\n Constant.create(linear, ...);\n \nScope objects are **not** thread-safe.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Constructors\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Scope](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope#Scope(org.tensorflow.ExecutionEnvironment))([ExecutionEnvironment](/versions/r2.11/api_docs/java/org/tensorflow/ExecutionEnvironment) env) Create a new top-level scope. |\n\n### Public Methods\n\n|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [OperationBuilder](/versions/r2.11/api_docs/java/org/tensorflow/OperationBuilder) | [applyControlDependencies](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope#applyControlDependencies(org.tensorflow.OperationBuilder))([OperationBuilder](/versions/r2.11/api_docs/java/org/tensorflow/OperationBuilder) builder) Adds each Operand in controlDependencies as a control input to the provided builder. |\n| [ExecutionEnvironment](/versions/r2.11/api_docs/java/org/tensorflow/ExecutionEnvironment) | [env](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope#env())() Returns the execution environment used by this scope. |\n| String | [makeOpName](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope#makeOpName(java.lang.String))(String defaultName) Create a unique name for an operator, using a provided default if necessary. |\n| [Scope](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope) | [withControlDependencies](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope#withControlDependencies(java.lang.Iterable\u003corg.tensorflow.Operand\u003c?\u003e\u003e))(Iterable\\\u003c[Operand](/versions/r2.11/api_docs/java/org/tensorflow/Operand)\\\u003c?\\\u003e\\\u003e controls) Returns a new scope where added operations will have the provided control dependencies. |\n| [Scope](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope) | [withName](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope#withName(java.lang.String))(String opName) Return a new scope that uses the provided name for an op. |\n| [Scope](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope) | [withSubScope](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope#withSubScope(java.lang.String))(String childScopeName) Returns a new scope where added operations will have the provided name prefix. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public\n**Scope**\n([ExecutionEnvironment](/versions/r2.11/api_docs/java/org/tensorflow/ExecutionEnvironment) env)\n\nCreate a new top-level scope. \n\n##### Parameters\n\n| env | The execution environment used by the scope. |\n|-----|----------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public [OperationBuilder](/versions/r2.11/api_docs/java/org/tensorflow/OperationBuilder)\n**applyControlDependencies**\n([OperationBuilder](/versions/r2.11/api_docs/java/org/tensorflow/OperationBuilder) builder)\n\nAdds each Operand in controlDependencies as a control input to the provided builder. \n\n##### Parameters\n\n| builder | OperationBuilder to add control inputs to |\n|---------|-------------------------------------------|\n\n#### public [ExecutionEnvironment](/versions/r2.11/api_docs/java/org/tensorflow/ExecutionEnvironment)\n**env**\n()\n\nReturns the execution environment used by this scope. \n\n#### public String\n**makeOpName**\n(String defaultName)\n\nCreate a unique name for an operator, using a provided default if necessary.\n\nThis is normally called only by operator building classes.\n\nThis method generates a unique name, appropriate for the name scope controlled by this\ninstance. Typical operator building code might look like\n\n scope.env().opBuilder(\"Const\", scope.makeOpName(\"Const\"))...\n \n**Note:** if you provide a composite operator building class (i.e, a class that creates a\nset of related operations by calling other operator building code), the provided name will act\nas a subscope to all underlying operators.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| defaultName | name for the underlying operator. |\n|-------------|-----------------------------------|\n\n##### Returns\n\n- unique name for the operator. \n\n##### Throws\n\n| IllegalArgumentException | if the default name is invalid. |\n|--------------------------|---------------------------------|\n\n#### public [Scope](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope)\n**withControlDependencies**\n(Iterable\\\u003c[Operand](/versions/r2.11/api_docs/java/org/tensorflow/Operand)\\\u003c?\\\u003e\\\u003e controls)\n\nReturns a new scope where added operations will have the provided control dependencies.\n\nOps created with this scope will have a control edge from each of the provided controls. All\nother properties are inherited from the current scope.\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| controls | control dependencies for ops created with the returned scope |\n|----------|--------------------------------------------------------------|\n\n##### Returns\n\n- a new scope with the provided control dependencies \n\n#### public [Scope](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope)\n**withName**\n(String opName)\n\nReturn a new scope that uses the provided name for an op.\n\nOperations created within this scope will have a name of the form `name/opName[_suffix]`. This lets you name a specific operator more meaningfully.\n\nNames must match the regular expression `[A-Za-z0-9.][A-Za-z0-9_.\\-]*`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| opName | name for an operator in the returned scope |\n|--------|--------------------------------------------|\n\n##### Returns\n\n- a new Scope that uses opName for operations. \n\n##### Throws\n\n| IllegalArgumentException | if the name is invalid |\n|--------------------------|------------------------|\n\n#### public [Scope](/versions/r2.11/api_docs/java/org/tensorflow/op/Scope)\n**withSubScope**\n(String childScopeName)\n\nReturns a new scope where added operations will have the provided name prefix.\n\nOps created with this scope will have `name/childScopeName/` as the prefix. The actual\nname will be unique in the returned scope. All other properties are inherited from the current\nscope.\n\nThe child scope name must match the regular expression `[A-Za-z0-9.][A-Za-z0-9_.\\-]*`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| childScopeName | name for the new child scope |\n|----------------|------------------------------|\n\n##### Returns\n\n- a new subscope \n\n##### Throws\n\n| IllegalArgumentException | if the name is invalid |\n|--------------------------|------------------------|"]]