Creating a float64 Variable in tensorflow

Viewed 12943

I am trying to do a logistic regression and my training dataset is derived from a a numpy float64 array. My code looks like,

import tensorflow as tf
graph = tf.Graph()
with graph.as_default():
    examples =tf.constant(mat6)  # mat6 is a numpy float64 array
    t_labels = tf.constant(labels) # labels is an a numpy float64 array
    W = tf.Variable(tf.truncated_normal([115713, 2]))
    b = tf.Variable(tf.zeros([2]))
    logits = tf.matmul(examples, W)+b

This throws an exception

TypeError: Input 'b' of 'MatMul' Op has type float32 that does not match type float64 of argument 'a'.

This probably because W and b are float32 and not float64. Is there a way to convert W and b OR create it as a float64

1 Answers
Related