# 监听器

## 什么是监听器?

监听器允许用户在Eclipse DL4J中“挂钩”到某些事件中。这允许你收集或打印对训练等任务有用的信息。例如，一个`ScoreIterationListener`允许你从神经网络的输出层打印训练分数。

## 用法

要将一个或多个监听器添加到一个多层网络或计算图中，请使用`addListener`方法：

```java
MultiLayerNetwork model = new MultiLayerNetwork(conf);
model.init();
//打印每次迭代的分数
model.setListeners(new ScoreIterationListener(1));
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://deeplearning4j.konduit.ai/zhong-wen-v1.0.0/mo-xing/jian-ting-qi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
