The networks in the paper on 1000-layer self-supervised RL are stacks of residual blocks. Each block has four repeated units, and one unit is a Dense layer, then layer normalisation, then the Swish activation. The block's input is added back immediately after the final activation. The paper defines the depth of a network as the total number of Dense layers across its residual blocks. Implement the block and the stack. All layers have the same width .
swish(x) returns elementwise, with the logistic function.
layer_norm(x, gain, bias, eps=1e-5) normalises over the last axis: subtract the mean of the features, divide by with the population variance, then multiply by gain and add bias (both of shape ).
residual_block(h, units, eps=1e-5)
h has shape or .units is a list of tuples (W, b, gain, bias), one per unit, with W of shape and the rest of shape . The Dense layer computes x @ W + b.residual_mlp(h, blocks, eps=1e-5)
blocks is a list of blocks, each a list of units as above.(out, depth): the output after all blocks, and the depth as the paper counts it.h. The inputs are not modified.