- Hands-On Artificial Intelligence for IoT
- Amita Kapoor
- 84字
- 2025-04-04 15:11:28
Keras
Keras is a high-level API that runs on top of TensorFlow. It allows for fast and easy prototyping. It supports both convolutional and recurrent neural networks, and even a combination of the two. It can run on both CPUs and GPUs. The following code performs matrix multiplication using Keras:
# Import the libraries
import keras.backend as K
import numpy as np
# Declare the data
A = np.random.rand(20,500)
B = np.random.rand(500,3000)
#Create Variable
x = K.variable(value=A)
y = K.variable(value=B)
z = K.dot(x,y)
print(K.eval(z))