Skip to content

Errors when using the tensorflow or tensorflow-gpu packages #216

Closed
@marunguy

Description

@marunguy

What is the recommended development environment?

  • my environment
    • windows 10 64bit
    • python 3.8.10 64bit
    • tensorflow 2.9.1
    • tensorflow-directml-plugin 0.0.1.dev220621
    • Intel Core i5-1135G7, Intel Iris Xe Graphics

An error occurs when running a simple example.

  • test code
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------------------------------
"""..."""

import tensorflow as tf

tf.debugging.set_log_device_placement(True)
# tf.enable_eager_execution()

from tensorflow import keras
from tensorflow.keras import layers

#---------------------------------------------------------------------------------------------------
def ex() -> None:
    """..."""
    inputs = keras.Input(shape=(3, 32, 32))
    x = layers.Conv2D(32, (3, 3), activation="relu")(inputs)
    x = layers.Flatten()(x)
    x = layers.Dense(256, activation="relu")(x)
    outputs = layers.Dense(10, activation="softmax")(x)

    model = keras.Model(inputs, outputs)
    model.summary()
#---------------------------------------------------------------------------------------------------
def main() -> None:
    """..."""
    ex()
#---------------------------------------------------------------------------------------------------
if __name__ == "__main__":
    main()
  • error message
(tf2dml_38) d:\ai\ai_test>python e.py
2022-06-23 14:46:49.848519: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-06-23 14:46:49.848783: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-06-23 14:46:51.668324: I tensorflow/c/logging.cc:34] Successfully opened dynamic library D:\devtool\pyvenv\tf2dml_38\lib\site-packages\tensorflow-plugins/directml/directml.0de2b4431c6572ee74152a7ee0cd3fb1534e4a95.dll
2022-06-23 14:46:51.669120: I tensorflow/c/logging.cc:34] Successfully opened dynamic library dxgi.dll
2022-06-23 14:46:51.672098: I tensorflow/c/logging.cc:34] Successfully opened dynamic library d3d12.dll
2022-06-23 14:46:51.733125: I tensorflow/c/logging.cc:34] DirectML device enumeration: found 1 compatible adapters.
2022-06-23 14:46:52.042786: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-06-23 14:46:52.043678: I tensorflow/c/logging.cc:34] DirectML: creating device on adapter 0 (Intel(R) Iris(R) Xe Graphics)
2022-06-23 14:46:52.070285: I tensorflow/c/logging.cc:34] Successfully opened dynamic library Kernel32.dll
2022-06-23 14:46:52.071152: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2022-06-23 14:46:52.071254: W tensorflow/core/common_runtime/pluggable_device/pluggable_device_bfc_allocator.cc:28] Overriding allow_growth setting because force_memory_growth was requested by the device.
2022-06-23 14:46:52.071518: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6951 MB memory) -> physical PluggableDevice (device: 0, name: DML, pci bus id: <undefined>)
2022-06-23 14:46:52.074304: I tensorflow/core/common_runtime/eager/execute.cc:1323] Executing op _EagerConst in device /job:localhost/replica:0/task:0/device:GPU:0
2022-06-23 14:46:52.076556: I tensorflow/core/common_runtime/eager/execute.cc:1323] Executing op _EagerConst in device /job:localhost/replica:0/task:0/device:GPU:0
2022-06-23 14:46:52.076744: I tensorflow/core/common_runtime/eager/execute.cc:1323] Executing op _EagerConst in device /job:localhost/replica:0/task:0/device:GPU:0
Traceback (most recent call last):
  File "e.py", line 31, in <module>
    main()
  File "e.py", line 28, in main
    ex()
  File "e.py", line 18, in ex
    x = layers.Conv2D(32, (3, 3), activation="relu")(inputs)
  File "D:\devtool\pyvenv\tf2dml_38\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "D:\devtool\pyvenv\tf2dml_38\lib\site-packages\keras\backend.py", line 1920, in random_uniform
    return tf.random.uniform(
tensorflow.python.framework.errors_impl.InvalidArgumentError: Multiple OpKernel registrations match NodeDef at the same priority '{{node RandomUniform}}': 'op: "RandomUniform" device_type: "GPU" constraint { name: "T" allowed_values { list { type: DT_INT32 } } } constraint { name: "dtype" allowed_values { list { type: DT_FLOAT } } } host_memory_arg: "shape"' and 'op: "RandomUniform" device_type: "GPU" constraint { name: "T" allowed_values { list { type: DT_INT32 } } } constraint { name: "dtype" allowed_values { list { type: DT_FLOAT } } } host_memory_arg: "shape"' [Op:RandomUniform]
  • error message with tensorflow 2.8.0
(tf2dml_38) d:\ai\ai_test>python e.py
2022-06-23 14:50:16.448936: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-06-23 14:50:16.449160: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "e.py", line 6, in <module>
    import tensorflow as tf
  File "D:\devtool\pyvenv\tf2dml_38\lib\site-packages\tensorflow\__init__.py", line 443, in <module>
    _ll.load_library(_plugin_dir)
  File "D:\devtool\pyvenv\tf2dml_38\lib\site-packages\tensorflow\python\framework\load_library.py", line 151, in load_library
    py_tf.TF_LoadLibrary(lib)
tensorflow.python.framework.errors_impl.NotFoundError: D:\devtool\pyvenv\tf2dml_38\lib\site-packages\tensorflow-plugins\tfdml_plugin.dll not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions