I currently use tensorflow 2.5 with GPU Quadro P1000. The tensorflow was built with cudatoolkit and cudnn to activate my GPU
In current, I have a large numpy array (4Gb) with np.uint8 dtype. The model was built using tf.keras.model but at every layer, the argument dtype, i use np.float32 but not tf.float32.
Although when calling model.fit(ndarray), I don’t convert to tf.Tensor and GPU still worked woth 40 - 50%.
My question is
(1): Is it possible to set the layers’ dtype by tf.dtype such as tf.float32 and use numpy array to directly model.fit() or model.predict() with active GPU without error, and vice versa?
(2) Does tensorflow, for every batch fed to tf.keras.Model automatically convert to the Tensor before training it (with the setting mentioned above), and if so, do I should convert to tf.Tensor (tf.constant) beforehand to boost performance and input pipeline, in that case, do I need to disable eager execution or do some trick to boost performance?
At current, the model is trained with 240 - 300 seconds per epoch with ~ 2300 batchs (256 batch size)
Thank you. I love to hear some response
Windows 10 Pro, TF 2.5, Numpy 1.19+, Python 3.8.11