26 #ifndef NVNEURAL_XMLNETWORKBUILDER_H
27 #define NVNEURAL_XMLNETWORKBUILDER_H
35 #include <Pugixml/pugixml.hpp>
42 class XmlModelPreprocessor;
225 std::map<std::string, unsigned int> activePrototypeVersionToId;
226 pugi::xml_node xmlNode;
230 bool m_enableDefaultFusing;
231 std::map<std::string, std::string> m_layerOverrides;
232 std::vector<std::string> m_manualFusingRules;
233 mutable std::vector<std::string> m_validFusingRules;
234 std::string m_fallbackClass;
236 bool m_enableInlining;
242 NeuralResult buildNetworkFromPreprocessor(
INetwork* pNetwork, detail::XmlModelPreprocessor& preprocessor)
const;
243 NeuralResult initPreprocessor(
INetwork* pNetwork, detail::XmlModelPreprocessor& preprocessor)
const;
Fundamental NvNeural data types are declared here.
NetworkBackendId
Enumeration describing common network backends.
Definition: CoreTypes.h:239
ActivationFunctionId
Enumeration describing common activation functions.
Definition: CoreTypes.h:259
NeuralResult
NeuralResult is a generic success/failure result type similar to COM HRESULT.
Definition: CoreTypes.h:275
Smart pointer class for tracking IRefObject instances.
Common class registry for instantiating objects and collecting plugin-provided descriptors.
Definition: CoreTypes.h:1801
ILayer is the base class for neural network layers.
Definition: LayerTypes.h:59
INetwork is the public interface to Network.
Definition: NetworkTypes.h:119
INetworkRuntime is a subset of the basic network interface that is accessible from layer classes duri...
Definition: CoreTypes.h:1129
IRuntimeOptionsHost is an interface that provides runtime option communication from the layer to the ...
Definition: CoreTypes.h:544
Intrusive pointer using IRefObject's reference counting system.
Definition: RefPtr.h:46
XML-based network builder.
Definition: XmlNetworkBuilder.h:57
XmlNetworkBuilder(const IClassRegistry *pRegistry)
Create an XmlNetworkBuilder.
Definition: XmlNetworkBuilder.cpp:77
NeuralResult setRuntimeOptionsHost(IRuntimeOptionsHost *pRuntimeOptionsHost)
Set the runtime options host pointer to pass to layers during building.
Definition: XmlNetworkBuilder.cpp:799
NeuralResult buildNetworkFromFile(INetwork *pNetwork, const char *pFilename) const
Builds a network from a file on disk.
Definition: XmlNetworkBuilder.cpp:208
virtual RefPtr< ILayer > createLayerObject(const std::string &name, const std::string &layerType, const std::string &objectClass) const
Creates a layer object for a given object class.
Definition: XmlNetworkBuilder.cpp:805
NeuralResult setInliningEnabled(bool enableInlining)
Enable or disable network inlining during preprocessing.
Definition: XmlNetworkBuilder.cpp:793
NeuralResult setScopeCallbackFunc(LayerScopeCallbackFunc scopeCallback)
Sets a function that will be called around layer-specific operations during buildNetwork calls.
Definition: XmlNetworkBuilder.cpp:126
virtual NeuralResult setLayerActivation(ILayer *pLayer, ActivationFunctionId activationId, const std::string &activationName) const
Sets an activation function on the indicated layer.
Definition: XmlNetworkBuilder.cpp:822
virtual RefPtr< IParameterNode > createParameterNode(ILayer *pLayer, pugi::xml_node node) const
Creates an appropriate parameter node for a given <Parameters> block.
Definition: XmlNetworkBuilder.cpp:817
NeuralResult clearLayerOverrides()
Removes all layer overrides.
Definition: XmlNetworkBuilder.cpp:84
NeuralResult setLoadDefaultFusingRules(bool enableDefaultFusing)
Turns ClassRegistry-based fusing rules on or off.
Definition: XmlNetworkBuilder.cpp:258
virtual NeuralResult setLayerInput(ILayer *pLayer, size_t inputIndex, ILayer *pInput) const
Sets an input on the indicated layer.
Definition: XmlNetworkBuilder.cpp:832
NeuralResult setLayerOverride(const char *pLayerName, const char *pObjectClass)
Overrides construction of a layer.
Definition: XmlNetworkBuilder.cpp:90
bool loadDefaultFusingRules() const
Returns true if ClassRegistry-based fusing rules are enabled.
Definition: XmlNetworkBuilder.cpp:264
NeuralResult buildNetworkFromXmlLiteral(INetwork *pNetwork, const char *pXmlLiteral) const
Builds a network from a provided XML literal.
Definition: XmlNetworkBuilder.cpp:233
NeuralResult setFallbackLayerType(const char *pObjectClass)
Set an emergency fallback object class when no candidates match the layer type.
Definition: XmlNetworkBuilder.cpp:113
std::function< void(const char *pLayerName)> LayerScopeCallbackFunc
Function type for setScopeCallbackFunc.
Definition: XmlNetworkBuilder.h:115
virtual NeuralResult setLayerAlpha(ILayer *pLayer, size_t alphaIndex, float alphaValue) const
Sets an activation coefficient on the indicated layer.
Definition: XmlNetworkBuilder.cpp:827
NeuralResult addFusingRule(const char *pFusingRule)
Adds a fusing rule to network construction.
Definition: XmlNetworkBuilder.cpp:269
This structure represent a prototype layer version (backend, tensor format and kernel type),...
Definition: CoreTypes.h:1697