clear method

void clear()
inherited

Clears the Network by removing all Layers, thereby returning it to its initial, empty state.

⚠️ Throws a StateError if the network has already been cleared.

Implementation

void clear() {
  if (layers.isEmpty) {
    throw StateError('Attempted to reset an already empty network.');
  }

  stopwatch.reset();
  layers.clear();
}