tf.keras.backend.variable
Stay organized with collections
Save and categorize content based on your preferences.
Instantiates a variable and returns it.
tf.keras.backend.variable(
value, dtype=None, name=None, constraint=None
)
Arguments |
value
|
Numpy array, initial value of the tensor.
|
dtype
|
Tensor type.
|
name
|
Optional name string for the tensor.
|
constraint
|
Optional projection function to be
applied to the variable after an optimizer update.
|
Returns |
A variable instance (with Keras metadata included).
|
Examples:
val = np.array([[1, 2], [3, 4]])
kvar = tf.keras.backend.variable(value=val, dtype='float64',
name='example_var')
tf.keras.backend.dtype(kvar)
'float64'
print(kvar)
<tf.Variable 'example_var:...' shape=(2, 2) dtype=float64, numpy=
array([[1., 2.],
[3., 4.]])>
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 2020-10-01 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 2020-10-01 UTC."],[],[]]