MPSNNImageNode(3)

NAME
MPSNNImageNode

SYNOPSIS

#import <MPSNNGraphNodes.h>

Inherits NSObject.

  Instance Methods
(nonnull instancetype) - initWithHandle:
(nonnull instancetype) - init

  Class Methods
(nonnull instancetype) + nodeWithHandle:
(nonnull instancetype) + exportedNodeWithHandle:

  Properties
id< MPSHandle > handle
MPSImageFeatureChannelFormat format
id< MPSImageAllocator > imageAllocator
BOOL exportFromGraph
BOOL synchronizeResource
BOOL BOOL stopGradient

Detailed Description

A placeholder node denoting the position of a MPSImage in a graph MPS neural network graphs are made up of filter nodes connected by image (or state) nodes. An image node is produced by one filter but may be consumed by more than one filter.

Most image nodes will be created by MPS and made available through MPSNNFilterNode.resultImage. Image nodes that are not created by MPS (i.e. 'the graph inputs') must be created by you.

Method Documentation

  + (nonnull instancetype) exportedNodeWithHandle: (NSObject< MPSHandle > *__nullable) handle
Create a autoreleased MPSNNImageNode with exportFromGraph = YES. Note: image is still temporary. See MPSNNImageNode.imageAllocator parameter.

  - (nonnull instancetype) init

  - (nonnull instancetype) initWithHandle: (NSObject< MPSHandle > *__nullable) handle

  + (nonnull instancetype) nodeWithHandle: (NSObject< MPSHandle > *__nullable) handle

Property Documentation

  - (BOOL) exportFromGraph [read], [write], [nonatomic], [assign]
Tag a image node for view later Most image nodes are private to the graph. These alias memory heavily and consequently generally have invalid state when the graph exits. When exportFromGraph = YES, the image is preserved and made available through the [MPSNNGraph encode... intermediateImages:... list.

CAUTION: exporting an image from a graph prevents MPS from recycling memory. It will nearly always cause the amount of memory used by the graph to increase by the size of the image. There will probably be a performance regression accordingly. This feature should generally be used only when the node is needed as an input for further work and recomputing it is prohibitively costly.

Default: NO

  - (MPSImageFeatureChannelFormat) format [read], [write], [nonatomic], [assign]
The preferred precision for the image Default: MPSImageFeatureChannelFormatNone, meaning MPS should pick a format Typically, this is 16-bit floating-point.

  - (id<MPSHandle>) handle [read], [write], [nonatomic], [retain]
MPS resource identifier See MPSHandle protocol description. Default: nil

  - (id<MPSImageAllocator>) imageAllocator [read], [write], [nonatomic], [retain]
Configurability for image allocation Allows you to influence how the image is allocated Default: defaultAllocator (MPSTemporaryImage)

  - (BOOL BOOL) stopGradient [read], [write], [nonatomic], [assign]
Stop training graph automatic creation at this node. An inference graph of MPSNNFilterNodes, MPSNNStateNodes and MPSNNImageNodes can be automatically converted to a training graph using -[MPSNNFilterNode trainingGraphWithSourceGradient:nodeHandler:]. Sometimes, an inference graph may contain extra nodes at start to do operations like resampling or range adjustment that should not be part of the training graph. To prevent gradient operations for these extra nodes from being included in the training graph, set <undesired node>=''>.resultImage.stopGradient = YES. This will prevent gradient propagation beyond this MPSNNImageNode. Default: NO

  - (BOOL) synchronizeResource [read], [write], [nonatomic], [assign]
Set to true to cause the resource to be synchronized with the CPU It is not needed on iOS/tvOS devices, where it does nothing.

Author

Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.