Error when using directml "Multiple OpKernel registrations match NodeDef at the same priority"

Issue

I have an AMD GPU and I want to train my model with using that GPU because on a CPU it takes a while. I did some research and I found Microsoft’s Direct ML and I thought I would give it a go.

Here’s the article I found and followed: https://docs.microsoft.com/en-gb/windows/ai/directml/gpu-tensorflow-plugin

As you can see python version 3.10 is supported

I am using python 3.10.2 and on the site it says that version is supported. So I activated my environment and installed the plugin. I went back to my code which is written in jupyter notebook and once I run:

train_set = image_dataset_from_directory(
    train_path,
    labels="inferred",
    label_mode = 'categorical',
    image_size=IMG_SIZE,
    batch_size=batch_size,
)

dev_set = image_dataset_from_directory(
    dev_path,
    labels="inferred",
    label_mode = 'categorical',
    image_size=IMG_SIZE,
    batch_size=batch_size,
)

test_set = image_dataset_from_directory(
    test_path,
    labels="inferred",
    label_mode = 'categorical',
    image_size=IMG_SIZE,
    batch_size=batch_size,
)
class_names = train_set.class_names
num_classes = len(class_names)

I got this error:

InvalidArgumentError: Multiple OpKernel registrations match NodeDef at the same priority ‘{{node Equal}}’: ‘op: "Equal" device_type: "GPU" constraint { name: "T" allowed_values { list { type: DT_INT64 } } }’ and ‘op: "Equal" device_type: "GPU" constraint { name: "T" allowed_values { list { type: DT_INT64 } } }’ [Op:Equal]

Running this:

print(tf.__version__)
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

2.9.1

Num GPUs Available: 1

I have no idea what is going on. Can I not use directml? It is detecting my GPU (RX Vega 64)..

Solution

I had the same problem using normal tensorflow package, I uninstalled tensorflow pip uninstall tensorflow and installed tensorflow-cpu like in the page pip install tensorflow-cpu==2.9Then it was working. I am using python 3.8. Hope this helps

Answered By – Martin MeRu

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published