如何通过调取父类方法的方式在不更改源码的情况下获得变量的输出
Created by: liu0haha123
Paddle 版本1.7.2 在使用ErnieModelForTokenClassification 是需要获取中间步骤的 的这两个参数,能否通过调用父类ERINEModel的forward方法来获取 pooled和encoded 或者其他能满足该要求的方法
def forward(self, *args, **kwargs):
"""
Args:
labels (optional, `Variable` of shape [batch_size, seq_len]):
ground truth label id for each token
Returns:
loss (`Variable` of shape []):
Cross entropy loss mean over batch and time, ignore positions where label == -100
if labels not set, returns None
logits (`Variable` of shape [batch_size, seq_len, hidden_size]):
output logits of classifier
"""
labels = kwargs.pop('labels', None)
pooled, encoded = super(ErnieModelForTokenClassification, self).forward(*args, **kwargs)