MPSImageSizeEncodingState

Trait MPSImageSizeEncodingState 

Source
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 { ... }
}
Available on crate feature 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§

Source

unsafe fn sourceWidth(&self) -> NSUInteger
where Self: Sized + Message,

The width of the source image passed to MPSCNNConvolution encode call.

Source

unsafe fn sourceHeight(&self) -> NSUInteger
where Self: Sized + Message,

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.
Source§

const NAME: &'static str = "MPSImageSizeEncodingState"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn MPSImageSizeEncodingState

Available on crate feature MPSNeuralNetwork only.

Implementations on Foreign Types§

Source§

impl<T> MPSImageSizeEncodingState for ProtocolObject<T>

Available on crate feature MPSNeuralNetwork only.

Implementors§

Source§

impl MPSImageSizeEncodingState for MPSCNNConvolutionGradientState

Available on crate features MPSCNNConvolution and MPSNeuralNetwork only.
Source§

impl MPSImageSizeEncodingState for MPSCNNConvolutionTransposeGradientState

Available on crate features MPSCNNConvolution and MPSNeuralNetwork only.