Implement spatiotemporal_transformer_block(X, params): one pre-norm transformer block for X of shape (T, N, D) (T frames, N spatial tokens per frame, D features).
Apply three sub-layers in order, each as x = x + SubLayer(LayerNorm(x)):
t, attend over its N tokens.n, attend over its T tokens.ReLU(x W1) W2.Rules:
eps = 1e-5.params holds NumPy arrays:
'Wqs', 'Wks', 'Wvs', 'Wos': (D, D) query/key/value/output projections for spatial attention'Wqt', 'Wkt', 'Wvt', 'Wot': (D, D), the same for temporal attention'W1': (D, D_ff), 'W2': (D_ff, D)Return a NumPy array of shape (T, N, D).