You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: generator.m
    path of file: ./repos/pix2pix/code/+p2p/+networks
    
    the code of the file until where you have to start completion: function model = generator(inputSize, inputChannels, outputChannels, depth)
% generator    pix2pix generator network

% Copyright 2020 The MathWorks, Inc.
    
    downChannels = [64,  128,  256,  512,  512, 512, 512, 512];
    upChannels =  [512, 512, 512, 512, 512, 256, 128, 64];
    

    
function model = generator(inputSize, inputChannels, outputChannels, depth)
% generator    pix2pix generator network

% Copyright 2020 The MathWorks, Inc.
    
    downChannels = [64,  128,  256,  512,  512, 512, 512, 512];
    upChannels =  [512, 512, 512, 512, 512, 256, 128, 64];
    
    if nargin < 4
        depth = numel(downChannels);
    else
        assert(depth <= 8, ...
            'p2p:networks:generator', ...
            'Current max depth is 8');
        % Modify down and up channels accordingly
        downChannels = downChannels(1:depth);
        upChannels = upChannels(9-depth:end