Convolutional neural networks for valid and efficient causal inference