void CompositeDataReader::CreateTransforms(const ConfigParameters& deserializerConfig) { std::string defaultModule = deserializerConfig("module"); argvector<ConfigParameters> inputs = deserializerConfig("input"); for (size_t i = 0; i < inputs.size(); ++i) { // Trying to find transfomers in a stream section of the config. auto inputSections = TryGetSectionsWithParameter(inputs[i], "transforms"); if (inputSections.size() > 1) { LogicError("Only a single 'transforms' config is allowed per stream."); } // No need to create anything for this stream, skipping. if (inputSections.empty()) { continue; } ConfigParameters input = inputs[i](inputSections.front()); std::wstring inputName = msra::strfun::utf16(input.ConfigName()); // Read tranformers in order and appending them to the transformer pipeline. argvector<ConfigParameters> transforms = input("transforms"); for (size_t j = 0; j < transforms.size(); ++j) { TransformerPtr transformer = CreateTransformer(transforms[j], defaultModule); m_transforms.push_back(Transformation{transformer, inputName}); } } }
[[nodiscard]] inline Transformer2D CreateTransformer(ContentScale contentScale = ContentScale::Default) { return CreateTransformer(Window::BaseSize(), contentScale); }
[[nodiscard]] inline Transformer2D CreateTransformer(int32 width, int32 height, ContentScale contentScale = ContentScale::Default) { return CreateTransformer(Size(width, height), contentScale); }