Load NumPy data in Tensorflow Last Updated : 18 Mar, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will be looking at the approach to load Numpy data in Tensorflow in the Python programming language. Using tf.data.Dataset.from_tensor_slices() function Under this approach, we are loading a Numpy array with the use of tf.data.Dataset.from_tensor_slices() method, we can get the slices of an array in the form of objects by using tf.data.Dataset.from_tensor_slices() method from the TensorFlow module. Syntax : tf.data.Dataset.from_tensor_slices(list) Return : Return the objects of sliced elements. Example 1: In this example, we are using tf.data.Dataset.from_tensor_slices() method, to get the slices of the 2D-array and then load this to a variable gfg. Python3 # import modules import tensorflow as tf import numpy as np # Creating data arr = np.array([[1, 2, 3, 4], [4, 5, 6, 0], [2, 0, 7, 8], [3, 7, 4, 2]]) # using tf.data.Dataset.from_tensor_slices() # method gfg = tf.data.Dataset.from_tensor_slices(arr) for i in gfg: print(i.numpy()) Output: [1 2 3 4] [4 5 6 0] [2 0 7 8] [3 7 4 2]Example 2: In this example, we will load the NumPy list of the variable gfg using the tf.data.Dataset.from_tensor_slices() function from the TensorFlow library in the Python programming language. Python3 # import modules import tensorflow as tf import numpy as np # Creating data list = [[5, 10], [3, 6], [1, 2], [5, 0]] # using tf.data.Dataset.from_tensor_slices() # method gfg = tf.data.Dataset.from_tensor_slices(list) for i in gfg: print(i.numpy()) Output: [ 5 10] [3 6] [1 2] [5 0] Comment More infoAdvertise with us Next Article Load text in Tensorflow G geetansh044 Follow Improve Article Tags : Python Geeks Premier League Geeks-Premier-League-2022 Python-numpy Tensorflow Practice Tags : python Similar Reads Load CSV data in Tensorflow This article will look at the ways to load CSV data in the Python programming language using TensorFlow. TensorFlow library provides the make_csv_dataset( ) function, which is used to read the data and use it in our programs. Loading single CSV File To get the single CSV data file from the URL, we 2 min read Load Images in Tensorflow - Python In this article, we are going to see how to load images in TensorFlow in Python. Loading Images in Tensorflow For loading Images Using Tenserflow, we use tf.keras.utils.load_img function, which loads the image from a particular provided path in PIL Format. PIL is a Python Imaging Library that gives 3 min read Save and load models in Tensorflow Training machine learning or deep learning model is time-consuming and shutting down the notebook causes all the weights and activations to disappear as the memory is flushed. Hence, we save models for reusability, collaboration, and continuation of training. Saving the model allows us to avoid leng 4 min read Load text in Tensorflow In this article, we are going to see how to load the text in Tensorflow using Python. Tensorflow is an open-source Machine Learning platform that helps to create production-ready Machine Learning pipelines. Using Tensorflow, one can easily manage large datasets and develop a Neural network model in 3 min read Python - tensorflow.gather_nd() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. gather_nd() is used to gather the slice from input tensor based on the indices provided. Syntax: tensorflow.gather_nd( params, indices, batch_dims, name) Parameters: pa 2 min read Tensor Data type in Tensorflow In the realm of data science and machine learning, understanding the tensor data type is fundamental, particularly when working with TensorFlow. Tensors are the core data structures used in TensorFlow to represent and manipulate data. This article explores the concept of tensors in the context of a 5 min read Like