Giter Club home page Giter Club logo

Comments (3)

PatriceVignola avatar PatriceVignola commented on August 22, 2024

Unfortunately, tensorflow-directml doesn't support DT_DOUBLE. If double precision is not a hard requirement for your training scenario, you could use DT_FLOAT to work around it.

from tensorflow-directml.

funky-soul avatar funky-soul commented on August 22, 2024

Thanks for the tip! Well, double precision is not necessary.
After having a close looking over the traceback, I noticed that the function that uses float64 comes from tensorflow.keras.metrics.MeanIoU.update_state().

in my team callback:

  IoU=MeanIoU(num_classes=2,dtype='float32')
  IoU.update_state(self.Y_val,self.Y_predict_val)  # This line uses DT_DOUBLE
  med_Iou=IoU.result().numpy()

I tryied to turn it into float32, without success. So I opened the file "C:\Users\USER\anaconda3\envs\tf2-directml\Lib\site-packages\tensorflow_core\python\keras\metrics.py" and saw 'dtype=dtypes.float64'.

Captura de tela 2022-06-27 120330

I changed it to 32, however new error appeared as follow on print:

Captura de tela 2022-06-27 121347

I will be glade if the is a way to use update_state() with directml

from tensorflow-directml.

funky-soul avatar funky-soul commented on August 22, 2024

SOLVED:
You will need to edit 'site-packages\tensorflow_core\python\keras\metrics.py' . As said by PatriceVignola early, directml doesn't support DT_DOUBLE, so you will need to change dtype arguments of self.total_cm and current_cm as follow (from dtype.float64 to dtype.float32):

Captura de tela 2022-07-01 104604 Captura de tela 2022-07-01 104532

After this my code runned flawless.

from tensorflow-directml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.