@@ -839,4 +839,67 @@ __attribute__((deprecated("This API is experimental.")))
839
839
840
840
@end
841
841
842
+ #pragma mark - Ones Category
843
+
844
+ @interface ExecuTorchTensor (Ones)
845
+
846
+ /* *
847
+ * Creates a tensor filled with ones, with the specified shape, data type, and shape dynamism.
848
+ *
849
+ * @param shape An NSArray of NSNumber objects representing the desired shape.
850
+ * @param dataType An ExecuTorchDataType value specifying the element type.
851
+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
852
+ * @return A new ExecuTorchTensor instance filled with ones.
853
+ */
854
+ + (instancetype )onesTensorWithShape : (NSArray <NSNumber *> *)shape
855
+ dataType : (ExecuTorchDataType)dataType
856
+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
857
+ NS_SWIFT_NAME(ones(shape:dataType:shapeDynamism:));
858
+
859
+ /* *
860
+ * Creates a tensor filled with ones, with the specified shape and data type.
861
+ *
862
+ * @param shape An NSArray of NSNumber objects representing the desired shape.
863
+ * @param dataType An ExecuTorchDataType value specifying the element type.
864
+ * @return A new ExecuTorchTensor instance filled with ones.
865
+ */
866
+ + (instancetype )onesTensorWithShape : (NSArray <NSNumber *> *)shape
867
+ dataType : (ExecuTorchDataType)dataType
868
+ NS_SWIFT_NAME(ones(shape:dataType:));
869
+
870
+ /* *
871
+ * Creates a tensor filled with ones similar to an existing tensor, with the specified data type and shape dynamism.
872
+ *
873
+ * @param tensor An existing ExecuTorchTensor instance whose shape and strides are used.
874
+ * @param dataType An ExecuTorchDataType value specifying the desired element type.
875
+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
876
+ * @return A new ExecuTorchTensor instance filled with ones.
877
+ */
878
+ + (instancetype )onesTensorLikeTensor : (ExecuTorchTensor *)tensor
879
+ dataType : (ExecuTorchDataType)dataType
880
+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
881
+ NS_SWIFT_NAME(ones(like:dataType:shapeDynamism:));
882
+
883
+ /* *
884
+ * Creates a tensor filled with ones similar to an existing tensor, with the specified data type.
885
+ *
886
+ * @param tensor An existing ExecuTorchTensor instance whose shape and strides are used.
887
+ * @param dataType An ExecuTorchDataType value specifying the desired element type.
888
+ * @return A new ExecuTorchTensor instance filled with ones.
889
+ */
890
+ + (instancetype )onesTensorLikeTensor : (ExecuTorchTensor *)tensor
891
+ dataType : (ExecuTorchDataType)dataType
892
+ NS_SWIFT_NAME(ones(like:dataType:));
893
+
894
+ /* *
895
+ * Creates a tensor filled with ones similar to an existing tensor.
896
+ *
897
+ * @param tensor An existing ExecuTorchTensor instance.
898
+ * @return A new ExecuTorchTensor instance filled with ones.
899
+ */
900
+ + (instancetype )onesTensorLikeTensor : (ExecuTorchTensor *)tensor
901
+ NS_SWIFT_NAME(ones(like:));
902
+
903
+ @end
904
+
842
905
NS_ASSUME_NONNULL_END
0 commit comments