简体   繁体   English

3D卷积张量流float64

[英]3d convolution tensorflow float64

I'm working on some convolutional calculation on the Tensorflow and got some strange errors with the Double Precision numbers. 我正在Tensorflow上进行一些卷积计算,但Double Precision Number出现了一些奇怪的错误。

I needed to calculate those tensors in float64 because of the precision issues. 由于精度问题,我需要计算float64中的那些张量。

The conv3d works fine with me on float32, but on the Double precision, it's only works on CPU and for the GPU the error is saying conv3d在float32上对我来说工作正常,但在Double precision上,它仅在CPU上工作,对于GPU,错误提示

InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'Conv3D': Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available.
Registered kernels:
  device='CPU'; T in [DT_HALF]
  device='CPU'; T in [DT_FLOAT]
  device='CPU'; T in [DT_DOUBLE]
  device='GPU'; T in [DT_HALF]
  device='GPU'; T in [DT_FLOAT]

 [[Node: Conv3D = Conv3D[T=DT_DOUBLE, data_format="NDHWC", dilations=[1, 1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1, 1], _device="/device:GPU:0"](Const, Const_1)]]

Below is my test code. 下面是我的测试代码。

import tensorflow as tf
import numpy as np

with tf.device('/device:GPU:0'):

    a = tf.constant(2 * np.ones([1, 200, 200, 200, 9], dtype=np.float64), dtype=tf.float64)

    b = tf.constant(np.ones([3, 3, 3, 9, 9], dtype=np.float64), dtype=tf.float64)


    sess = tf.Session()

    init = tf.global_variables_initializer()

    sess.run(init)


    c = tf.nn.conv3d(a, b, strides=[1, 1, 1, 1, 1], padding='SAME')
    print(a)
    print(b)
    print(c)
    for i in range(1000):
        print(sess.run(c))

is there any way to use gpus for these ops? 有什么办法可以在这些操作上使用GPU?

Support for double precision on a GPU is hardware dependent. GPU上对双精度的支持取决于硬件。 A quick search for your make and model and "support for double precision" should get you an answer whether your GPU can support double precision math. 快速搜索品牌和型号以及“支持双精度”将为您解答GPU是否可以支持双精度数学。

A quick search for my GPU (gtx 1060) and its support for double precision resulted in this link: https://devtalk.nvidia.com/default/topic/995849/does-the-gtx1060-support-double-precision-/ 快速搜索我的GPU(gtx 1060)及其对双精度的支持产生了以下链接: https : //devtalk.nvidia.com/default/topic/995849/does-the-gtx1060-support-double-precision-/

For the gtx 1060, the throughput for double precision math is 1/32 that of single precision math. 对于gtx 1060,双精度数学的吞吐量是单精度数学的1/32。 So even if your GPU supports it, the performance many not match your expectations. 因此,即使您的GPU支持它,性能也可能无法满足您的期望。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM