Python – tensorflow.guarantee_const()
TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning neural networks.
guarantee_const() is used to assure TensorFlow runtime that input tensor is constant.
Syntax: tensorflow.guarantee_const( input, name)
Parameters:
- input: It is a Tensor.
- name(optional): It defines the name for the operation
Returns: It returns a Tensor same as input Tensor.
Example 1:
Python3
import tensorflow as tf
x = tf.guarantee_const( 5 )
print ( "x: " , x)
|
Output:
x: tf.Tensor(5, shape=(), dtype=int32)
Example 2:
Python3
import tensorflow as tf
x = tf.Variable( 2.0 , name = "x" )
z = tf.Variable( 4.0 , name = "z" )
y = tf.guarantee_const([x, z])
print ( "y: " , y)
|
Output:
y: tf.Tensor([2. 4.], shape=(2, ), dtype=float32)
Last Updated :
30 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...