of remote nodes will provoked after several time steps while it is short for the nearest nodes to influence it. On the other hand, in real-world traffic networks, the spatial dependencies are inherently dynamical which are influenced by many factors such as traffic accidents, weather conditions as well as rush hours. As shown in Fig.1(b), the spatial patterns of traffic flows change significantly as time goes by. Thus we argue that an effective traffic forecasting model should be able to model dynamical spatial dependencies. Furthermore, the influence of upstream and downstream traffic flows is also quite different, thus the spatial dependencies should be modeled as directed.

To address this limitation, we propose a novel paradigm of self-attention based graph neural network, named [*spatial transformer*]{} to dynamically learn directed spatial dependencies by considering the real-time traffic conditions, connectivity and distance among sensors as well as traffic flow directions. We first enhance the node features with spatial and temporal positional embedding to incorporate the connectivity, distance as well as time information into each node, then several latent high-dimensional subspace are learned, in which spatial dependencies are dynamically computed to reflect the time-varying directed dependencies among nodes. Furthermore, through the self-attention mechanism, we 