How do I split Tensorflow datasets?

You may use Dataset.take() and Dataset.skip(): train_size = int(0.7 * DATASET_SIZE) val_size = int(0.15 * DATASET_SIZE) test_size = int(0.15 * DATASET_SIZE) full_dataset = tf.data.TFRecordDataset(FLAGS.input_file) full_dataset = full_dataset.shuffle() train_dataset = full_dataset.take(train_size) test_dataset = full_dataset.skip(train_size) val_dataset = test_dataset.skip(test_size) test_dataset = test_dataset.take(test_size) For more generality, I gave an example using a 70/15/15 train/val/test split but if you don’t … Read more

What is the meaning of the “None” in model.summary of KERAS?

None means this dimension is variable. The first dimension in a keras model is always the batch size. You don’t need fixed batch sizes, unless in very specific cases (for instance, when working with stateful=True LSTM layers). That’s why this dimension is often ignored when you define your model. For instance, when you define input_shape=(100,200), … Read more

How to set specific gpu in tensorflow?

There are 3 ways to achieve this: Using CUDA_VISIBLE_DEVICES environment variable. by setting environment variable CUDA_VISIBLE_DEVICES=”1″ makes only device 1 visible and by setting CUDA_VISIBLE_DEVICES=”0,1″ makes devices 0 and 1 visible. You can do this in python by having a line os.environ[“CUDA_VISIBLE_DEVICES”]=”0,1″ after importing os package. Using with tf.device(‘/gpu:2’) and creating the graph. Then it … Read more

What is the meaning of the word logits in TensorFlow? [duplicate]

Logits is an overloaded term which can mean many different things: In Math, Logit is a function that maps probabilities ([0, 1]) to R ((-inf, inf)) Probability of 0.5 corresponds to a logit of 0. Negative logit correspond to probabilities less than 0.5, positive to > 0.5. In ML, it can be the vector of … Read more

How does TensorFlow name tensors?

Your observations on Tensor naming are absolutely correct: the name of a Tensor is the concatenation of the name of the operation that produced it, a colon (:), and the index of that tensor in the outputs of the operation that produced it. Therefore the tensor named “foo:2” is the output of the op named … Read more