Open pkumar-a opened 2 years ago
Although tensorflow-directml can run on most hardware that supports D3D12, we unfortunately cannot guarantee that the performance will be better than the CPU, especially when using old hardware or integrated graphics. The Intel HD Graphics 520 is an example of hardware where we haven't seen great results compared to the CPU.
System Information
Windows 10 - Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz 2.81 GHz
Repro Details
Execute the following code in an environment with directml to run on gpu and an environment without directml to run on cpu
Describe the expected behavior I have been trying to execute the following code using directml and compare the training times in CPU and GPU but I am not seeing any difference in training times. Can someone help me with troubleshooting the issue
Code to reproduce the issue import tensorflow.compat.v1 as tf from tensorflow.keras import layers import numpy as np
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() x_train = x_train / 255.0 x_test = x_test / 255.0
model = tf.keras.models.Sequential([ layers.Flatten(input_shape=(28, 28, 1)), layers.Dense(4096,activation='relu'), layers.Dense(4096,activation='relu'), layers.Dense(10, activation='softmax') ]) model.summary()
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'],)
model.fit(np.expand_dims(x_train,3), y_train, epochs=2, batch_size=1024)
Other info / logs GPU Usage-![image](https://user-images.githubusercontent.com/38827146/177302710-36fc7831-1724-4b64-a3f4-40cd17ca8ed2.png)
CPU Usage-![image](https://user-images.githubusercontent.com/38827146/177302858-14270783-8991-4439-983c-52e4ca752131.png)