Skip to content

two_stage

TwoStageExtractor

Bases: Module

This module combines two feature extractors into a single network.

The input data is expected to be of shape [batch_size, upper_seq_len, input_channels, lower_seq_len]. An example would be vibration data recorded in spaced intervals, where lower_seq_len is the length of an interval and upper_seq_len is the window size of a sliding window over the intervals.

The lower_stage is applied to each interval individually to extract features. The upper_stage is then applied to the extracted features of the window. The resulting feature vector should represent the window without the need to manually extract features from the raw data of the intervals.

__init__(lower_stage, upper_stage)

Create a new two-stage extractor.

The lower stage needs to take a tensor of shape [batch_size, input_channels, seq_len] and return a tensor of shape [batch_size, lower_output_units]. The upper stage needs to take a tensor of shape [batch_size, upper_seq_len, lower_output_units] and return a tensor of shape [batch_size, upper_output_units]. Args: lower_stage: upper_stage:

forward(inputs)

Apply the two-stage extractor to the input tensor.

The input tensor is expected to be of shape [batch_size, upper_seq_len, input_channels, lower_seq_len]. The output tensor will be of shape [batch_size, upper_output_units].

Parameters:

Name Type Description Default
inputs Tensor

the input tensor

required

Returns:

Type Description
Tensor

an output tensor of shape [batch_size, upper_output_units]