import sys; import tensorflow as tf; if not tf.test.is_gpu_available(cuda_only=False, min_cuda_compute_capability=None): print("is_gpu_available() failed; exit.", file = sys.stderr); exit(1); with tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(log_device_placement=True)) as s: a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b') c = tf.matmul(a, b) print(s.run(c)) with tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(log_device_placement=True)) as s: batch_size = 32 x = tf.compat.v1.random.uniform([batch_size, 10, 16], name='x') f = tf.compat.v1.random.uniform([3, 16, 16], name='filter') output = tf.compat.v1.nn.conv1d(x, f, stride=2, padding="VALID",name='output') print(s.run(output).shape)