Hello
I am running a simple image classification deep learning model using tensor flow.
For installation of tensor flow , I have followed the instructions as per the below link :-
Install TensorFlow with pip
But when I am trying to fit the model, its giving me following error :-
InternalError: Failed copying input tensor from /job:localhost/replica:0/task:0/device:CPU:0 to /job:localhost/replica:0/task:0/device:GPU:0 in order to run _EagerConst: Dst tensor is not initialized.
My model summary is as shown below :-
Model: “sequential”
Layer (type) Output Shape Param #
dense (Dense) (None, 100) 15052900
dense_1 (Dense) (None, 1) 101
=================================================================
Total params: 15,053,001
Trainable params: 15,053,001
Non-trainable params: 0
Please note that when I am running the same model after hiding GPU from visible devices using below command , my model is training but training time is very high
tf.config.set_visible_devices(, ‘GPU’)
I am using windows 11 OS, and I have NVIDA GeForce GTX 1650 Ti GPU present on my laptop. RAM is 32 GB.
I have also tried to restrict the GPU memory to 1 GB using below commands :-
gpus = tf.config.experimental.list_physical_devices(‘GPU’)
if gpus:
# Restrict TensorFlow to only allocate 1GB of memory on the first GPU
try:
tf.config.experimental.set_virtual_device_configuration(gpus[0],
[tf.config.experimental.VirtualDeviceConfiguration(memory_limit=1024)])
logical_gpus = tf.config.experimental.list_logical_devices(‘GPU’)
print(len(gpus), “Physical GPUs,”, len(logical_gpus), “Logical GPUs”)
except RuntimeError as e:
# Virtual devices must be set before GPUs have been initialized
print(e)
But still I am getting the same error while training the model
So I want to understand that what steps are required to resolve this error for GPU ?