def clone(orig, n):
    """Construct `n` copies of a layer, with distinct weights.

    i.e. `clone(f, 3)(x)` computes `f(f'(f''(x)))`.
    """
    if n == 0:
        return layerize(noop())
    layers = [orig]
    for i in range(n - 1):
        layers.append(copy.deepcopy(orig))
        layers[-1].set_id()
    return FeedForward(layers)
def clone ( orig , n ) : if n == 0 : return layerize ( noop ( ) ) layers = [ orig ] for i in range ( n - 1 ) : layers . append ( copy . deepcopy ( orig ) ) layers [ - 1 ] . set_id ( ) return FeedForward ( layers )
Construct `n` copies of a layer, with distinct weights.

    i.e. `clone(f, 3)(x)` computes `f(f'(f''(x)))`.