@@ -980,4 +980,87 @@ __attribute__((deprecated("This API is experimental.")))
980980
981981@end
982982
983+ #pragma mark - RandomNormal Category
984+
985+ @interface ExecuTorchTensor (RandomNormal)
986+
987+ /* *
988+ * Creates a tensor with random values drawn from a normal distribution,
989+ * with full specification of shape, strides, data type, and shape dynamism.
990+ *
991+ * @param shape An NSArray of NSNumber objects representing the desired shape.
992+ * @param strides An NSArray of NSNumber objects representing the desired strides.
993+ * @param dataType An ExecuTorchDataType value specifying the element type.
994+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
995+ * @return A new ExecuTorchTensor instance filled with values from a normal distribution.
996+ */
997+ + (instancetype )randomNormalTensorWithShape : (NSArray <NSNumber *> *)shape
998+ strides : (NSArray <NSNumber *> *)strides
999+ dataType : (ExecuTorchDataType)dataType
1000+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1001+ NS_SWIFT_NAME(randn(shape:strides:dataType:shapeDynamism:));
1002+
1003+ /* *
1004+ * Creates a tensor with random values drawn from a normal distribution,
1005+ * with the specified shape and data type.
1006+ *
1007+ * @param shape An NSArray of NSNumber objects representing the desired shape.
1008+ * @param dataType An ExecuTorchDataType value specifying the element type.
1009+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
1010+ * @return A new ExecuTorchTensor instance filled with values from a normal distribution.
1011+ */
1012+ + (instancetype )randomNormalTensorWithShape : (NSArray <NSNumber *> *)shape
1013+ dataType : (ExecuTorchDataType)dataType
1014+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1015+ NS_SWIFT_NAME(randn(shape:dataType:shapeDynamism:));
1016+
1017+ /* *
1018+ * Creates a tensor with random values drawn from a normal distribution,
1019+ * with the specified shape (using dynamic bound shape) and data type.
1020+ *
1021+ * @param shape An NSArray of NSNumber objects representing the desired shape.
1022+ * @param dataType An ExecuTorchDataType value specifying the element type.
1023+ * @return A new ExecuTorchTensor instance filled with values from a normal distribution.
1024+ */
1025+ + (instancetype )randomNormalTensorWithShape : (NSArray <NSNumber *> *)shape
1026+ dataType : (ExecuTorchDataType)dataType
1027+ NS_SWIFT_NAME(randn(shape:dataType:));
1028+
1029+ /* *
1030+ * Creates a tensor with random normal values similar to an existing tensor,
1031+ * with the specified data type and shape dynamism.
1032+ *
1033+ * @param tensor An existing ExecuTorchTensor instance whose shape and strides are used.
1034+ * @param dataType An ExecuTorchDataType value specifying the desired element type.
1035+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
1036+ * @return A new ExecuTorchTensor instance filled with values from a normal distribution.
1037+ */
1038+ + (instancetype )randomNormalTensorLikeTensor : (ExecuTorchTensor *)tensor
1039+ dataType : (ExecuTorchDataType)dataType
1040+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1041+ NS_SWIFT_NAME(randn(like:dataType:shapeDynamism:));
1042+
1043+ /* *
1044+ * Creates a tensor with random normal values similar to an existing tensor,
1045+ * with the specified data type.
1046+ *
1047+ * @param tensor An existing ExecuTorchTensor instance whose shape and strides are used.
1048+ * @param dataType An ExecuTorchDataType value specifying the desired element type.
1049+ * @return A new ExecuTorchTensor instance filled with values from a normal distribution.
1050+ */
1051+ + (instancetype )randomNormalTensorLikeTensor : (ExecuTorchTensor *)tensor
1052+ dataType : (ExecuTorchDataType)dataType
1053+ NS_SWIFT_NAME(randn(like:dataType:));
1054+
1055+ /* *
1056+ * Creates a tensor with random normal values similar to an existing tensor.
1057+ *
1058+ * @param tensor An existing ExecuTorchTensor instance.
1059+ * @return A new ExecuTorchTensor instance filled with values from a normal distribution.
1060+ */
1061+ + (instancetype )randomNormalTensorLikeTensor : (ExecuTorchTensor *)tensor
1062+ NS_SWIFT_NAME(randn(like:));
1063+
1064+ @end
1065+
9831066NS_ASSUME_NONNULL_END
0 commit comments