I've written my own matrix multiplication implementation in TensorFlow that works with tf placeholders when their dimensions are properly defined. But many times in neural networks you want to leave one of the dimensions undefined so that the batch size or size of the input can change such as:
X = tf.placeholder(tf.float32, shape=(None, n_inputs), name="X")
y = tf.placeholder(tf.int64, shape=(None), name="y")
In my implementation, I first check the dimensions of the matrices so that they match and so that I can initialize a matrix with the correct dimensions with:
(m, n) = A.get_shape().as_list()
But then when I use it in a tf neural network I get the error:
raise ValueError("None values not supported.")
Because my matrix multiplication only works for defined matrices. Is there a way to handle this error so that it will work when the dimensions are eventually defined? Tensorflow's tf.matmul() must have a way but I can't figure it out. https://www.tensorflow.org/api_docs/python/tf/linalg/matmul