0

I am studying TensorFlow through this github repository

https://github.com/deeplearningzerotoall/TensorFlow/blob/master/tf_2.x/lab-10-1-1-mnist_nn_softmax.ipynb

and I don't understand what .\ means here:

train_dataset = tf.data.Dataset.from_tensor_slices((train_x, train_y)).\
    shuffle(buffer_size=100000).\
    prefetch(buffer_size=batch_size).\
    batch(batch_size, drop_remainder=True)
ruohola
  • 21,987
  • 6
  • 62
  • 97
  • \ is a python's line break. – Oleg O Mar 03 '20 at 15:44
  • 1
    .\ isn't an operator; as others have explained, \ is used to *continue* to the next line. In this example, it just happens that each line to be continued ended with a `.`. – Scott Hunter Mar 03 '20 at 15:46
  • Please see also how a code like this should have been formatted: https://stackoverflow.com/a/8683240/5378816 – VPfB Mar 03 '20 at 16:02

1 Answers1

1

Backslash is used to escape the next character, which is a newline in this case. This allows to split the long call chain to multiple lines.

ruohola
  • 21,987
  • 6
  • 62
  • 97