I would like to add a constant tensor of values to a graph. Ideally, I want to describe the tensor as a floating point representation and have either the optimiser replace it or a helper builder do it for me. What is the correct way to do this? Thanks
Hi @asj ,
In TensorFlow, to add a constant tensor to a graph while allowing for potential optimization:
- Create a constant tensor using tf.constant().
- Convert the constant tensor to a tf.Variable.
- Use this variable in your model operations.
This approach gives you flexibility: you can start with known constant values but allow them to be fine-tuned if needed, or keep them fixed if that’s more appropriate for your model architecture.
Additionally you can go through this official documentation , and this one for better understanding .
Hope this helps ,
Thank you .