# Does TensorFlow C++ API have the python Linspace equivalent

**URL:** <https://discuss.ai.google.dev/t/does-tensorflow-c-api-have-the-python-linspace-equivalent/28785>\
**Category:** General Discussion\
**Tags:** cpp, python, tensorflow-data, api\
**Created:** [November 27, 2023, 3:43am UTC](https://discuss.ai.google.dev/t/does-tensorflow-c-api-have-the-python-linspace-equivalent/28785 "2023-11-27T03:43:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PMcG](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/pmcg/32/16714_2.png) [@PMcG](https://discuss.ai.google.dev/u/PMcG)\
**Post date:** [November 27, 2023, 3:43am UTC](https://discuss.ai.google.dev/t/does-tensorflow-c-api-have-the-python-linspace-equivalent/28785/1 "2023-11-27T03:43:37Z")

</div>

In the processing of porting on of the TensorFlow python tutorials to C++ API and require Linspace equivalent. Currently I handcrafted one but would like to use the API functions.

Thanks PMcG

---

<div class="post-metadata">

**Author:** ![Aniket\_Dubey](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/aniket_dubey/32/16664_2.png) [@Aniket\_Dubey](https://discuss.ai.google.dev/u/Aniket_Dubey)\
**Post date:** [July 30, 2024, 10:06am UTC](https://discuss.ai.google.dev/t/does-tensorflow-c-api-have-the-python-linspace-equivalent/28785/3 "2024-07-30T10:06:31Z")

</div>

Hi @PMcG ,

In the TensorFlow C++ API, there isn’t a direct equivalent to the `linspace` function provided in the Python API. However, you can achieve similar functionality using the `tf::linspace` function.

You can refer to this [documentation](https://www.tensorflow.org/api_docs/python/tf/linspace) for more details.

ThanK You .
