Tensorflow | tf.data.Dataset.from_tensor_slices() Last Updated : 03 Oct, 2019 Comments Improve Suggest changes Like Article Like Report With the help 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. Syntax : tf.data.Dataset.from_tensor_slices(list) Return : Return the objects of sliced elements. Example #1 : In this example we can see that by using tf.data.Dataset.from_tensor_slices() method, we are able to get the slices of list or array. Python3 1=1 # import tensorflow import tensorflow as tf # using tf.data.Dataset.from_tensor_slices() method gfg = tf.data.Dataset.from_tensor_slices([1, 2, 3, 4, 5]) for ele in gfg: print(ele.numpy()) Output : 1 2 3 4 5 Example #2 : Python3 1=1 # import tensorflow import tensorflow as tf # using tf.data.Dataset.from_tensor_slices() method gfg = tf.data.Dataset.from_tensor_slices([[5, 10], [3, 6]]) for ele in gfg: print(ele.numpy()) Output : [5, 10] [3, 6] Comment More infoAdvertise with us Next Article Tensorflow | tf.data.Dataset.from_tensor_slices() J Jitender_1998 Follow Improve Article Tags : Technical Scripter Python Tensorflow Practice Tags : python Similar Reads Tensorflow | tf.data.Dataset.reduce() With the help of tf.data.Dataset.reduce() method, we can get the reduced transformation of all the elements in the dataset by using tf.data.Dataset.reduce() method. Syntax : tf.data.Dataset.reduce() Return : Return combined single result after transformation. Note : These given examples will demonst 1 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 TensorFlow - How to create one hot tensor TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. One hot tensor is a Tensor in which all the values at indices where i =j and i!=j is same. Method Used: one_hot: This method accepts a Tensor of indices, a scalar defin 2 min read Difference Between Dataset.from_tensors and Dataset.from_tensor_slices In this article, we will learn the difference between from_tensors and from_tensor_slices. Both of these functionalities are used to iterate a dataset or convert a data to TensorFlow data pipeline but how it is done difference lies there. Suppose we have a dataset represented as a Numpy matrix of sh 3 min read How to Reshape a Tensor in Tensorflow? Tensor reshaping is the process of reshaping the order and total number of elements in tensors while only the shape is being changed. It is a fundamental operation in TensorFlow that allows you to change the shape of a tensor without changing its underlying data. Using tf.reshape() In TensorFlow, th 4 min read TensorFlow - How to create a numpy ndarray from a tensor TensorFlow is an open-source Python library designed by Google to develop Machine Learning models and deep-learning, neural networks. Create a Numpy array from a torch.tensor A Pytorch Tensor is basically the same as a NumPy array. This means it does not know anything about deep learning or computat 2 min read Python - tensorflow.convert_to_tensor() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. convert_to_tensor() is used to convert the given value to a Tensor Syntax: tensorflow.convert_to_tensor( value, dtype, dtype_hint, name ) Parameters: value: It is the va 2 min read TensorFlow - How to create a tensor with all elements set to one TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. Methods Used: tf.ones: This methods accepts the shape and type and returns a tensor of given shape and type having all values set to 1.tf.fill: This method accepts shape 1 min read What is Tensor and Tensor Shapes? Tensors are multidimensional arrays, fundamental to TensorFlow's operations and computations. Understanding key concepts like tensor shape, size, rank, and dimension is crucial for effectively using TensorFlow in machine learning projects. In this article, we are going to understand tensor and its p 4 min read Tensor Indexing in Tensorflow In the realm of machine learning and deep learning, tensors are fundamental data structures used to represent numerical data with multiple dimensions. TensorFlow, a powerful numerical computation library, equips you with an intuitive and versatile set of operations for manipulating and accessing dat 10 min read Like