Example #1
0
        List <CNTK.Variable> traverse_content_and_styles_nodes(CNTK.Function model)
        {
            var nodes      = new List <CNTK.Variable>();
            var node_names = new string[] { "conv5_2", "conv1_1", "conv2_1", "conv3_1", "conv4_1", "conv5_1" };

            foreach (var node_name in node_names)
            {
                var node = model.FindByName(node_name);
                nodes.Add(node);
            }
            return(nodes);
        }
Example #2
0
        /// <summary>
        /// Get a list of content and style layers from the given neural network.
        /// </summary>
        /// <param name="input">The neural network to process.</param>
        /// <returns>A list of content and style layers in the neural network.</returns>
        public static List <CNTK.Variable> GetContentAndStyleLayers(
            this CNTK.Function input)
        {
            var layers     = new List <CNTK.Variable>();
            var layerNames = new string[] { "conv5_2", "conv1_1", "conv2_1", "conv3_1", "conv4_1", "conv5_1" };

            foreach (var layerName in layerNames)
            {
                var layer = input.FindByName(layerName);
                layers.Add(layer);
            }
            return(layers);
        }