Class MPSGraphExecutable

  • All Implemented Interfaces:
    NSObject

    public class MPSGraphExecutable
    extends MPSGraphObject
    Compiled representation of a compute graph executable. An MPSGraphExecutable is a compiled graph for specific feeds for specific targetTensors and target operations. API-Since: 15.0
    • Constructor Detail

      • MPSGraphExecutable

        protected MPSGraphExecutable​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static MPSGraphExecutable allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • encodeToCommandBufferInputsArrayResultsArrayExecutionDescriptor

        @NotNull
        public @NotNull NSArray<? extends MPSGraphTensorData> encodeToCommandBufferInputsArrayResultsArrayExecutionDescriptor​(@NotNull
                                                                                                                              @NotNull MPSCommandBuffer commandBuffer,
                                                                                                                              @NotNull
                                                                                                                              @NotNull NSArray<? extends MPSGraphTensorData> inputsArray,
                                                                                                                              @Nullable
                                                                                                                              @Nullable NSArray<? extends MPSGraphTensorData> resultsArray,
                                                                                                                              @Nullable
                                                                                                                              @Nullable MPSGraphExecutableExecutionDescriptor executionDescriptor)
        Runs the graph for given feeds to return targetTensor values, ensuring all target operations also executed. This call is asynchronous and will return immediately after finishing encoding. - Parameters: - commandBuffer: CommandBuffer passed to exectute the graph on, commitAndContinue might be called, please don't rely on underlying MTLCommandBuffer to remain uncommitted - inputsArray: Feeds tensorData for the placeholder tensors, same order as arguments of main function - resultsArray: Tensors for which the caller wishes MPSGraphTensorData to be returned - executionDescriptor: ExecutionDescriptor to be passed in and used, - Returns: A valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.
      • feedTensors

        @Nullable
        public @Nullable NSArray<? extends MPSGraphTensor> feedTensors()
        Feed tensors for the graph, can be used to order the inputs when executable was created with an MPSGraph
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • options

        public long options()
        Options for the graph executable. Default value is `MPSGraphOptionsDefault`.
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • runAsyncWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor

        @NotNull
        public @NotNull NSArray<? extends MPSGraphTensorData> runAsyncWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor​(@NotNull
                                                                                                                                    @NotNull MTLCommandQueue commandQueue,
                                                                                                                                    @NotNull
                                                                                                                                    @NotNull NSArray<? extends MPSGraphTensorData> inputsArray,
                                                                                                                                    @Nullable
                                                                                                                                    @Nullable NSArray<? extends MPSGraphTensorData> resultsArray,
                                                                                                                                    @Nullable
                                                                                                                                    @Nullable MPSGraphExecutableExecutionDescriptor executionDescriptor)
        Runs the graph for given feeds to return targetTensor values, ensuring all target operations also executed. This call is asynchronous and will return immediately. - Parameters: - commandQueue: CommandQueue passed to exectute the graph on. - inputsArray: Feeds tensorData for the placeholder tensors, same order as arguments of main function. - resultsArray: Tensors for which the caller wishes MPSGraphTensorData to be returned. - executionDescriptor: ExecutionDescriptor to be passed in and used. - Returns: A valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.
      • runWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor

        @NotNull
        public @NotNull NSArray<? extends MPSGraphTensorData> runWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor​(@NotNull
                                                                                                                               @NotNull MTLCommandQueue commandQueue,
                                                                                                                               @NotNull
                                                                                                                               @NotNull NSArray<? extends MPSGraphTensorData> inputsArray,
                                                                                                                               @Nullable
                                                                                                                               @Nullable NSArray<? extends MPSGraphTensorData> resultsArray,
                                                                                                                               @Nullable
                                                                                                                               @Nullable MPSGraphExecutableExecutionDescriptor executionDescriptor)
        Runs the graph for given feeds to return targetTensor values, ensuring all target operations also executed. This call is synchronous and will return on completion of execution. - Parameters: - commandQueue: CommandQueue passed to exectute the graph on. - inputsArray: Feeds tensorData for the placeholder tensors, same order as arguments of main function. - resultsArray: Results tensorData for which the caller wishes MPSGraphTensorData to be returned. - Returns: A valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.
      • setOptions

        public void setOptions​(long value)
        Options for the graph executable. Default value is `MPSGraphOptionsDefault`.
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • specializeWithDeviceInputTypesCompilationDescriptor

        public void specializeWithDeviceInputTypesCompilationDescriptor​(@Nullable
                                                                        @Nullable MPSGraphDevice device,
                                                                        @NotNull
                                                                        @NotNull NSArray<? extends MPSGraphType> inputTypes,
                                                                        @Nullable
                                                                        @Nullable MPSGraphCompilationDescriptor compilationDescriptor)
        Specialize the MPSGraphExecutable and optimize it, use this method to choose when specialization happens, else it occurs at encode time automatically. - Parameters: - device: optional MPSGraph device to compile with - inputTypes: input types - compilationDescriptor: compilationDescriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can.
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • targetTensors

        @Nullable
        public @Nullable NSArray<? extends MPSGraphTensor> targetTensors()
        Target tensors for the graph, can be used to order the outputs when executable was created with an MPSGraph
      • version_static

        public static long version_static()
      • getOutputTypesWithDeviceInputTypesCompilationDescriptor

        @Nullable
        public @Nullable NSArray<? extends MPSGraphShapedType> getOutputTypesWithDeviceInputTypesCompilationDescriptor​(@Nullable
                                                                                                                       @Nullable MPSGraphDevice device,
                                                                                                                       @NotNull
                                                                                                                       @NotNull NSArray<? extends MPSGraphType> inputTypes,
                                                                                                                       @Nullable
                                                                                                                       @Nullable MPSGraphCompilationDescriptor compilationDescriptor)
        Get output shapes for a specialized MPSGraphExecutable - in case specialization has not been done yet then calling this function will specialize for the given input shapes. - Parameters: - device: optional MPSGraph device to compile with - inputTypes: input types - compilationDescriptor: compilationDescriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can. API-Since: 16.3
      • initWithMPSGraphPackageAtURLCompilationDescriptor

        public MPSGraphExecutable initWithMPSGraphPackageAtURLCompilationDescriptor​(@NotNull
                                                                                    @NotNull NSURL mpsgraphPackageURL,
                                                                                    @Nullable
                                                                                    @Nullable MPSGraphCompilationDescriptor compilationDescriptor)
        Initialize the MPSGraph executable with the package at the provided url. - Parameters: - mpsgraphPackageURL: The URL where to read the serialized MPSGraphExecutable. - compilationDescriptor: Compilation descriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can. API-Since: 17.0
      • serializeToMPSGraphPackageAtURLDescriptor

        public void serializeToMPSGraphPackageAtURLDescriptor​(@NotNull
                                                              @NotNull NSURL url,
                                                              @Nullable
                                                              @Nullable MPSGraphExecutableSerializationDescriptor descriptor)
        Serialize the MPSGraph executable at the provided url. - Parameters: - url: The URL where to serialize the MPSGraph executable. - descriptor: The descriptor to be used to serialize the graph. API-Since: 17.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.