Skip to content
This repository was archived by the owner on Mar 3, 2024. It is now read-only.
This repository was archived by the owner on Mar 3, 2024. It is now read-only.

AttributeError: 'Node' object has no attribute 'output_masks' #26

@yangbin-Neil

Description

@yangbin-Neil

Describe the Bug
I am getting AttributeError: 'Node' object has no attribute 'output_masks' when I use keras-xlnet
Version Info
keras 2.2.0
tensorflow 1.9.0
keras-xlnet 0.16.0
scikit-learn 0.19.1
numpy 1.19.5
python 3.6.13
Minimal Codes To Reproduce
The location of the error is as follows:

File "D:\anaconda3\envs\Xlnet-gru-crf36new\lib\site-packages\keras_xlnet\xlnet.py", line 128, in build_xlnet
)([token_embed, query_input])
File "D:\anaconda3\envs\Xlnet-gru-crf36new\lib\site-packages\keras\engine\base_layer.py", line 446, in call
previous_mask = _collect_previous_mask(inputs)
File "D:\anaconda3\envs\Xlnet-gru-crf36new\lib\site-packages\keras\engine\base_layer.py", line 1326, in _collect_previous_mask
mask = node.output_masks[tensor_index]
AttributeError: 'Node' object has no attribute 'output_masks'

def _collect_previous_mask(input_tensors):
    """Retrieves the output mask(s) of the previous node.

    # Arguments
        input_tensors: A tensor or list of tensors.

    # Returns
        A mask tensor or list of mask tensors.
    """
    input_tensors = to_list(input_tensors)
    masks = []
    for x in input_tensors:
        if hasattr(x, '_keras_history'):
            inbound_layer, node_index, tensor_index = x._keras_history
            node = inbound_layer._inbound_nodes[node_index]
            mask = node.output_masks[tensor_index]             # I got an error here, but I don't know why
            masks.append(mask)
        else:
            masks.append(None)
    if len(masks) == 1:
        return masks[0]
    return masks

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions