Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

tensorflow.keras.utils.to_categorical

a = tf.keras.utils.to_categorical([0, 1, 2, 3], num_classes=4)a = tf.constant(a, shape=[4, 4])print(a)tf.Tensor(  [[1. 0. 0. 0.]   [0. 1. 0. 0.]   [0. 0. 1. 0.]   [0. 0. 0. 1.]], shape=(4, 4), dtype=float32)
Comment

PREVIOUS NEXT
Code Example
Python :: how to strip whitespace in python 
Python :: how to get the length of a string in python 
Python :: pandas pivot table 
Python :: iterate over a list python 
Python :: tkinter simple application 
Python :: How to install a python packagae 
Python :: how to convert string to datetime 
Python :: python os get dir path 
Python :: float64 python 
Python :: string list to int list python 
Python :: has no attribute python 
Python :: get files in directory and subdirectory 
Python :: any python 
Python :: python library for downsampling a photo 
Python :: how to convert pandas price column to integer 
Python :: how to code a trading bot in python 
Python :: messages in django 
Python :: usage of thread in python 
Python :: web scraping using python code 
Python :: change column names pandas 
Python :: matplotlib default style 
Python :: black code formatter 
Python :: python write subprocess stdout stderr to file 
Python :: Python __mul__ magic method 
Python :: remove trailing zeros python 
Python :: SUMOFPROD1 Solution 
Python :: python search in json file 
Python :: check if a file exists in python 
Python :: python argparse argument without value 
Python :: data frame 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =