Walk me through a PyTorch neural network training loop: explain what each part does and calculate missing values in the code snippet.
Implement training_loop_values to calculate the derived values for a network with two fully connected layers. Return the flattened input size, total trainable parameters including biases, batches per epoch, optimizer updates, and the final batch output shape. The input is represented by a JSON-compatible dictionary, and the output must be a dictionary with the specified derived values.
def training_loop_values(num_samples, input_shape, batch_size, hidden_units, output_units, epochs, drop_last):