LeCun
Stay organized with collections
Save and categorize content based on your preferences.
LeCun normal initializer.
Draws samples from a random distribution. * *
If the distribution is TRUNCATED_NORMAL, it draws samples from a truncated normal distribution
centered on 0
with
stddev = sqrt(1 / fanIn)
where fanIn
is the number of input units in the
weight tensor.
If the distribution is UNIFORM, itraws samples from a uniform distribution within
[-limit, limit]
, where limit = Math.sqrt(3 / fanIn)
(fanIn
is
the number of input units in the weight tensor)
Examples:
LeCun Normal:
long seed = 1001l;
LeCunNormal<TFloat32, TFloat32> initializer =
new org.tensorflow.framework.initializers.LeCunNormal<>(tf,
Distribution.TRUNCATED_NORMAL, seed);
Operand<TFloat32> values =
initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);
LeCun Uniform:
long seed = 1001l;
LeCunNormal<TFloat32, TFloat32> initializer =
new org.tensorflow.framework.initializers.LeCunNormal<>(tf,
Distribution.UNIFORM, seed);
Operand<TFloat32> values =
initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);
*
NOTE: *
For a LeCunNormal equivalent initializer, use TRUNCATED_NORMAL
for the distribution parameter. *
For a LeCunUniform equivalent initializer, use UNIFORM
*
for the distribution parameter. *
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
Creates a LeCunNormal Initializer
Parameters
tf |
the TensorFlow Ops |
distribution |
The distribution type for the Glorot initializer. |
seed |
the seed for random number generation. An initializer created with a given seed
will always produce the same random tensor for a given shape and dtype.
|
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,["# LeCun\n\npublic class **LeCun** \nLeCun normal initializer.\n\nDraws samples from a random distribution. \\* \\*\n\nIf the distribution is TRUNCATED_NORMAL, it draws samples from a truncated normal distribution\ncentered on `0` with `\nstddev = sqrt(1 / fanIn)` where `fanIn` is the number of input units in the\nweight tensor.\n\nIf the distribution is UNIFORM, itraws samples from a uniform distribution within `\n[-limit, limit]`, where `limit = Math.sqrt(3 / fanIn)` (`fanIn` is\nthe number of input units in the weight tensor)\n\nExamples:\n\nLeCun Normal:\n\n```\n long seed = 1001l;\n LeCunNormal\u003cTFloat32, TFloat32\u003e initializer =\n new org.tensorflow.framework.initializers.LeCunNormal\u003c\u003e(tf,\n Distribution.TRUNCATED_NORMAL, seed);\n Operand\u003cTFloat32\u003e values =\n initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);\n \n```\n\nLeCun Uniform:\n\n```\n long seed = 1001l;\n LeCunNormal\u003cTFloat32, TFloat32\u003e initializer =\n new org.tensorflow.framework.initializers.LeCunNormal\u003c\u003e(tf,\n Distribution.UNIFORM, seed);\n Operand\u003cTFloat32\u003e values =\n initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);\n \n```\n\\*\n\n**NOTE:** \\*\n\nFor a LeCunNormal equivalent initializer, use [TRUNCATED_NORMAL](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling.Distribution#TRUNCATED_NORMAL) for the distribution parameter. \\*\n\nFor a LeCunUniform equivalent initializer, use [UNIFORM](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling.Distribution#UNIFORM) \\*\nfor the distribution parameter. \\*\n\n\u003cbr /\u003e\n\n##### See Also\n\n- [ERROR(href=\"https://papers.nips.cc/paper/6698-self-normalizing-neural-networks\"\u003eSelf-Normalizing\n Neural Networks, Klambauer et al., 2017](/jvm/api_docs/java)`/`[Self-Normalizing\n Neural Networks, Klambauer et al., 2017](https://papers.nips.cc/paper/6698-self-normalizing-neural-networks)`)`\n- [Efficient Backprop, Lecun et\n al., 1998](http://yann.lecun.com/exdb/publis/pdf/lecun-98b.pdf)\n- [VarianceScaling.Distribution](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling.Distribution)\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\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Inherited Constants\n\nFrom class [org.tensorflow.framework.initializers.VarianceScaling](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling) \n\n|--------|---------------------------------------------------------------------------------------------------------|---|\n| double | [SCALE_DEFAULT](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling#SCALE_DEFAULT) | |\n\n### Inherited Fields\n\nFrom class [org.tensorflow.framework.initializers.VarianceScaling](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling) \n\n|-------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|---|\n| public static final [VarianceScaling.Distribution](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling.Distribution) | [DISTRIBUTION_DEFAULT](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling#DISTRIBUTION_DEFAULT) | |\n| public static final [VarianceScaling.Mode](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling.Mode) | [MODE_DEFAULT](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling#MODE_DEFAULT) | |\n\n### Public Constructors\n\n|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [LeCun](/jvm/api_docs/java/org/tensorflow/framework/initializers/LeCun#LeCun(Ops, org.tensorflow.framework.initializers.VarianceScaling.Distribution, long))(Ops tf, [VarianceScaling.Distribution](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling.Distribution) distribution, long seed) Creates a LeCunNormal Initializer |\n\n### Inherited Methods\n\nFrom class [org.tensorflow.framework.initializers.VarianceScaling](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling) \n\n|-----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e | [call](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling#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\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**LeCun**\n(Ops tf, [VarianceScaling.Distribution](/jvm/api_docs/java/org/tensorflow/framework/initializers/VarianceScaling.Distribution) distribution, long seed)\n\nCreates a LeCunNormal Initializer \n\n##### Parameters\n\n| tf | the TensorFlow Ops |\n| distribution | The distribution type for the Glorot initializer. |\n| seed | the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype. |\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|"]]