classdef ReshapeLayer1001 < nnet.layer.Layer & nnet.layer.Formattable
    % A custom layer auto-generated while importing an ONNX network.
    %#codegen

    %#ok<*PROPLC>
    %#ok<*NBRAK>
    %#ok<*INUSL>
    %#ok<*VARARG>
    properties (Learnable)
    end

    properties (State)
    end

    properties
        Vars
        NumDims
    end

    methods(Static, Hidden)
        % Specify the properties of the class that will not be modified
        % after the first assignment.
        function p = matlabCodegenNontunableProperties(~)
            p = {
                % Constants, i.e., Vars, NumDims and all learnables and states
                'Vars'
                'NumDims'
                };
        end
    end


    methods(Static, Hidden)
        % Instantiate a codegenable layer instance from a MATLAB layer instance
        function this_cg = matlabCodegenToRedirected(mlInstance)
            this_cg = EDHR_Net_SCNew.coder.ReshapeLayer1001(mlInstance);
        end
        function this_ml = matlabCodegenFromRedirected(cgInstance)
            this_ml = EDHR_Net_SCNew.ReshapeLayer1001(cgInstance.Name);
            if isstruct(cgInstance.Vars)
                names = fieldnames(cgInstance.Vars);
                for i=1:numel(names)
                    fieldname = names{i};
                    this_ml.Vars.(fieldname) = dlarray(cgInstance.Vars.(fieldname));
                end
            else
                this_ml.Vars = [];
            end
            this_ml.NumDims = cgInstance.NumDims;
        end
    end

    methods
        function this = ReshapeLayer1001(mlInstance)
            this.Name = mlInstance.Name;
            this.OutputNames = {'model_1_separable_co'};
            if isstruct(mlInstance.Vars)
                names = fieldnames(mlInstance.Vars);
                for i=1:numel(names)
                    fieldname = names{i};
                    this.Vars.(fieldname) = EDHR_Net_SCNew.coder.ops.extractIfDlarray(mlInstance.Vars.(fieldname));
                end
            else
                this.Vars = [];
            end

            this.NumDims = mlInstance.NumDims;
        end

        function [model_1_separable_co] = predict(this, model_1_separable_3__)
            if isdlarray(model_1_separable_3__)
                model_1_separable_3_ = stripdims(model_1_separable_3__);
            else
                model_1_separable_3_ = model_1_separable_3__;
            end
            model_1_separable_3NumDims = 4;
            model_1_separable_3 = EDHR_Net_SCNew.coder.ops.permuteInputVar(model_1_separable_3_, [4 3 1 2], 4);

            [model_1_separable_co__, model_1_separable_coNumDims__] = ReshapeGraph1002(this, model_1_separable_3, model_1_separable_3NumDims, false);
            model_1_separable_co_ = EDHR_Net_SCNew.coder.ops.permuteOutputVar(model_1_separable_co__, [3 4 2 1], 4);

            model_1_separable_co = dlarray(single(model_1_separable_co_), 'SSCB');
        end

        function [model_1_separable_co, model_1_separable_coNumDims1003] = ReshapeGraph1002(this, model_1_separable_3, model_1_separable_3NumDims, Training)

            % Execute the operators:
            % Reshape:
            [shape1001, model_1_separable_coNumDims] = EDHR_Net_SCNew.coder.ops.prepareReshapeArgs(model_1_separable_3, this.Vars.new_shape__606, coder.const(model_1_separable_3NumDims), 0);
            model_1_separable_co = reshape(model_1_separable_3, shape1001{:});

            % Set graph output arguments
            model_1_separable_coNumDims1003 = model_1_separable_coNumDims;

        end

    end

end