pub unsafe trait MPSImageSizeEncodingState: NSObjectProtocol {
// Provided methods
unsafe fn sourceWidth(&self) -> NSUInteger
where Self: Sized + Message { ... }
unsafe fn sourceHeight(&self) -> NSUInteger
where Self: Sized + Message { ... }
}MPSNeuralNetworkTypes only.Expand description
MPSStates conforming to this protocol contain information about a image size elsewhere in the graph
In some graphs a sequence of operations are done, then they are undone ins a series of ‘reverse’ operations. Examples might be pooling vs pooling gradient / upsampling, or convolution vs. convolution transpose. In such cases, the ‘reverse’ pass generally is converting from a smaller image to a larger image, and there is insufficient information to do this correctly. Several answers exist and we don’t know which is correct.
As an example, consider trying to ‘undo’ integer division with a multiplication. The expression c = a/b is incomplete because there is also a remainder, which may constitute information lost. If we want to reconstitute a based on c and b, we need to use a = c * b + remainder, not just a = cb. Similarly, when undoing a downsizing operation, we need the original size to find which answer in the range of a = cb + [0,b-1] is the right one.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn sourceWidth(&self) -> NSUInteger
unsafe fn sourceWidth(&self) -> NSUInteger
The width of the source image passed to MPSCNNConvolution encode call.
Sourceunsafe fn sourceHeight(&self) -> NSUInteger
unsafe fn sourceHeight(&self) -> NSUInteger
The height of the source image passed to MPSCNNConvolution encode call.
Trait Implementations§
Source§impl ProtocolType for dyn MPSImageSizeEncodingState
Available on crate feature MPSNeuralNetwork only.
impl ProtocolType for dyn MPSImageSizeEncodingState
MPSNeuralNetwork only.impl<T> ImplementedBy<T> for dyn MPSImageSizeEncodingState
MPSNeuralNetwork only.Implementations on Foreign Types§
impl<T> MPSImageSizeEncodingState for ProtocolObject<T>where
T: ?Sized + MPSImageSizeEncodingState,
MPSNeuralNetwork only.Implementors§
impl MPSImageSizeEncodingState for MPSCNNConvolutionGradientState
MPSCNNConvolution and MPSNeuralNetwork only.impl MPSImageSizeEncodingState for MPSCNNConvolutionTransposeGradientState
MPSCNNConvolution and MPSNeuralNetwork only.