code: public void setListeners(TrainingListener... listeners) {
          List<TrainingListener> list = new ArrayList<>();
          //Check: user might have done setListeners(null) thinking this would clear the current listeners.
          //This results in an TrainingListener[1] with a single null value -> results in a NPE later
          if (listeners != null && listeners.length > 0) {
              for (TrainingListener i : listeners) {
                  if (i != null)
                      list.add(i);
              }
          }
          setListeners(list);
      }
docs: Set the trainingListeners for the ComputationGraph (and all layers in the network)