@@ -846,7 +846,23 @@ def zeros_like(model, dtype=None, opt=False):
846
846
847
847
848
848
def zeros (shape , dtype = None ):
849
- """Create a `TensorVariable` filled with zeros, closer to NumPy's syntax than ``alloc``."""
849
+ """
850
+ Create a `TensorVariable` filled with zeros, closer to NumPy's syntax than `alloc`.
851
+
852
+ Parameters
853
+ ----------
854
+ shape : int or tuple of int
855
+ Shape of the empty array, e.g., ``(2, 3)`` or ``2``.
856
+ dtype : data-type, optional
857
+ Desired output data-type for the array, e.g, `numpy.int8`. Default is
858
+ `numpy.float64`.
859
+
860
+ Returns
861
+ -------
862
+ tensor
863
+ Tensor the shape of shape containing zeros of the type of dtype.
864
+ """
865
+ # Check if shape is a single integer or a sequence
850
866
if not (
851
867
isinstance (shape , np .ndarray | Sequence )
852
868
or (isinstance (shape , TensorVariable ) and shape .ndim > 0 )
@@ -858,7 +874,23 @@ def zeros(shape, dtype=None):
858
874
859
875
860
876
def ones (shape , dtype = None ):
861
- """Create a `TensorVariable` filled with ones, closer to NumPy's syntax than ``alloc``."""
877
+ """
878
+ Create a `TensorVariable` filled with ones, closer to NumPy's syntax than `alloc`.
879
+
880
+ Parameters
881
+ ----------
882
+ shape : int or tuple of int
883
+ Shape of the empty array, e.g., ``(2, 3)`` or ``2``.
884
+ dtype : data-type, optional
885
+ Desired output data-type for the array, e.g, `numpy.int8`. Default is
886
+ `numpy.float64`.
887
+
888
+ Returns
889
+ -------
890
+ tensor
891
+ Tensor the shape of shape containing ones of the type of dtype.
892
+ """
893
+ # Check if shape is a single integer or a sequence
862
894
if not (
863
895
isinstance (shape , np .ndarray | Sequence )
864
896
or (isinstance (shape , TensorVariable ) and shape .ndim > 0 )
0 commit comments