Constant
Stay organized with collections
Save and categorize content based on your preferences.
Initializer that generates tensors with a constant value.
Examples:
Constant<TFloat32> initializer =
new org.tensorflow.framework.initializers.Constant<>(tf, 3f);
Operand<TFloat32> values =
initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);
Public Constructors
|
Constant(Ops tf, long value)
Creates an Initializer that generates tensors with a constant value.
|
|
Constant(Ops tf, double value)
Creates an Initializer that generates tensors with a constant value.
|
|
Constant(Ops tf, boolean value)
Creates an Initializer that generates tensors with a constant value.
|
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Constructors
public
Constant
(Ops tf, long value)
Creates an Initializer that generates tensors with a constant value.
Parameters
tf |
the TensorFlow Ops |
value |
a long value used for the constant.
|
public
Constant
(Ops tf, double value)
Creates an Initializer that generates tensors with a constant value.
Parameters
tf |
the TensorFlow Ops |
value |
a double value used for the constant.
|
public
Constant
(Ops tf, boolean value)
Creates an Initializer that generates tensors with a constant value.
Parameters
tf |
the TensorFlow Ops |
value |
a boolean value used for the constant.
|
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 2021-11-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-11-29 UTC."],[],[],null,["# Constant\n\npublic class **Constant** \nInitializer that generates tensors with a constant value.\n\nExamples:\n\n```\n Constant\u003cTFloat32\u003e initializer =\n new org.tensorflow.framework.initializers.Constant\u003c\u003e(tf, 3f);\n Operand\u003cTFloat32\u003e values =\n initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);\n \n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Constructors\n\n|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Constant](/jvm/api_docs/java/org/tensorflow/framework/initializers/Constant#Constant(Ops, long))(Ops tf, long value) Creates an Initializer that generates tensors with a constant value. |\n| | [Constant](/jvm/api_docs/java/org/tensorflow/framework/initializers/Constant#Constant(Ops, double))(Ops tf, double value) Creates an Initializer that generates tensors with a constant value. |\n| | [Constant](/jvm/api_docs/java/org/tensorflow/framework/initializers/Constant#Constant(Ops, boolean))(Ops tf, boolean value) Creates an Initializer that generates tensors with a constant value. |\n\n### Public Methods\n\n|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e | [call](/jvm/api_docs/java/org/tensorflow/framework/initializers/Constant#call(org.tensorflow.Operand\u003corg.tensorflow.types.TInt64\u003e, java.lang.Class\u003cT\u003e))([Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003c[TInt64](/jvm/api_docs/java/org/tensorflow/types/TInt64)\\\u003e dims, Class\\\u003cT\\\u003e type) |\n\n### Inherited Methods\n\nFrom class [org.tensorflow.framework.initializers.BaseInitializer](/jvm/api_docs/java/org/tensorflow/framework/initializers/BaseInitializer) \n\n|-----|---------------------------------------------------------------------------------------------------------------------|\n| Ops | [getTF](/jvm/api_docs/java/org/tensorflow/framework/initializers/BaseInitializer#getTF())() Gets the TensorFlow Ops |\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\nFrom interface [org.tensorflow.framework.initializers.Initializer](/jvm/api_docs/java/org/tensorflow/framework/initializers/Initializer) \n\n|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e | [call](/jvm/api_docs/java/org/tensorflow/framework/initializers/Initializer#call(org.tensorflow.Operand\u003corg.tensorflow.types.TInt64\u003e, java.lang.Class\u003cT\u003e))([Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003c[TInt64](/jvm/api_docs/java/org/tensorflow/types/TInt64)\\\u003e dims, Class\\\u003cT\\\u003e type) Generates the operation used to perform the initialization. |\n\nPublic Constructors\n-------------------\n\n#### public\n**Constant**\n(Ops tf, long value)\n\nCreates an Initializer that generates tensors with a constant value. \n\n##### Parameters\n\n| tf | the TensorFlow Ops |\n| value | a long value used for the constant. |\n|-------|-------------------------------------|\n\n#### public\n**Constant**\n(Ops tf, double value)\n\nCreates an Initializer that generates tensors with a constant value. \n\n##### Parameters\n\n| tf | the TensorFlow Ops |\n| value | a double value used for the constant. |\n|-------|---------------------------------------|\n\n#### public\n**Constant**\n(Ops tf, boolean value)\n\nCreates an Initializer that generates tensors with a constant value. \n\n##### Parameters\n\n| tf | the TensorFlow Ops |\n| value | a boolean value used for the constant. |\n|-------|----------------------------------------|\n\nPublic Methods\n--------------\n\n#### public [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e\n**call**\n([Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003c[TInt64](/jvm/api_docs/java/org/tensorflow/types/TInt64)\\\u003e dims, Class\\\u003cT\\\u003e type)"]]