def train_head(self, num_epochs):
    'Trains the head model for a given number of epochs.\n\n    SGD is used as an optimizer.\n\n    Args:\n      num_epochs: how many epochs should be trained\n\n    Returns:\n      A list of train_loss values after every epoch trained.\n\n    Raises:\n      RuntimeError: when prepare_bottlenecks() has not been called.\n    '
    if (not hasattr(self, 'train_bottlenecks')):
        raise RuntimeError('prepare_bottlenecks has not been called')
    results = []
    for _ in range(num_epochs):
        loss = self._train_one_epoch(self._generate_batches(self.train_bottlenecks, self.train_labels))
        results.append(loss)
    return results
Trains the head model for a given number of epochs.

SGD is used as an optimizer.

Args:
  num_epochs: how many epochs should be trained

Returns:
  A list of train_loss values after every epoch trained.

Raises:
  RuntimeError: when prepare_bottlenecks() has not been called.
def train_head(self, num_epochs):
    'Trains the head model for a given number of epochs.\n\n    SGD is used as an optimizer.\n\n    Args:\n      num_epochs: how many epochs should be trained\n\n    Returns:\n      A list of train_loss values after every epoch trained.\n\n    Raises:\n      RuntimeError: when prepare_bottlenecks() has not been called.\n    '
    if (not hasattr(self, 'train_bottlenecks')):
        raise RuntimeError('prepare_bottlenecks has not been called')
    results = []
    for _ in range(num_epochs):
        loss = self._train_one_epoch(self._generate_batches(self.train_bottlenecks, self.train_labels))
        results.append(loss)
    return results