@@ -138,9 +138,9 @@ def __init__(
138
138
See Also
139
139
--------
140
140
* :doc:`/tutorial/class_tensor` - Getting started with the tensor class
141
- * :meth:`pyttb.tensor. from_function` - Create a tensor from a function
141
+ * :meth:`from_function` - Create a tensor from a function
142
142
such as :meth:`numpy.ones`
143
- * :meth:`pyttb.tensor. copy` - Make a deep copy of a tensor
143
+ * :meth:`copy` - Make a deep copy of a tensor
144
144
* :meth:`pyttb.sptensor.to_tensor` - Convert a sparse tensor to a dense tensor
145
145
* :meth:`pyttb.ktensor.to_tensor` - Convert a Kruskal tensor to a dense tensor
146
146
* :meth:`pyttb.ttensor.to_tensor` - Convert a Tucker tensor to a dense tensor
@@ -2876,8 +2876,9 @@ def tenones(shape: Shape, order: Union[Literal["F"], Literal["C"]] = "F") -> ten
2876
2876
----------
2877
2877
shape:
2878
2878
Shape of resulting tensor.
2879
- order:
2880
- Memory layout for resulting tensor.
2879
+ order: optional
2880
+ Memory layout for resulting tensor (default: F).
2881
+ *Note: C order is not recommended.*
2881
2882
2882
2883
Returns
2883
2884
-------
@@ -2897,6 +2898,10 @@ def tenones(shape: Shape, order: Union[Literal["F"], Literal["C"]] = "F") -> ten
2897
2898
[[1. 1. 1.]
2898
2899
[1. 1. 1.]
2899
2900
[1. 1. 1.]]
2901
+
2902
+ See Also
2903
+ --------
2904
+ * :meth:`pyttb.tensor.from_function` - Create a tensor from a function.
2900
2905
"""
2901
2906
2902
2907
def ones (shape : Tuple [int , ...]) -> np .ndarray :
@@ -2912,8 +2917,9 @@ def tenzeros(shape: Shape, order: Union[Literal["F"], Literal["C"]] = "F") -> te
2912
2917
----------
2913
2918
shape:
2914
2919
Shape of resulting tensor.
2915
- order:
2916
- Memory layout for resulting tensor.
2920
+ order: optional
2921
+ Memory layout for resulting tensor (default: F).
2922
+ *Note: C order is not recommended.*
2917
2923
2918
2924
Returns
2919
2925
-------
@@ -2948,8 +2954,9 @@ def tenrand(shape: Shape, order: Union[Literal["F"], Literal["C"]] = "F") -> ten
2948
2954
----------
2949
2955
shape:
2950
2956
Shape of resulting tensor.
2951
- order:
2952
- Memory layout for resulting tensor.
2957
+ order: optional
2958
+ Memory layout for resulting tensor (default: F).
2959
+ *Note: C order is not recommended.*
2953
2960
2954
2961
Returns
2955
2962
-------
@@ -2968,9 +2975,7 @@ def tenrand(shape: Shape, order: Union[Literal["F"], Literal["C"]] = "F") -> ten
2968
2975
# Typing doesn't play nice with partial
2969
2976
# mypy issue: 1484
2970
2977
def unit_uniform (pass_through_shape : Tuple [int , ...]) -> np .ndarray :
2971
- data = np .random .uniform (low = 0 , high = 1 , size = pass_through_shape )
2972
- if order == "F" :
2973
- return np .asfortranarray (data )
2978
+ data = np .random .uniform (low = 0 , high = 1 , size = np .prod (pass_through_shape ))
2974
2979
return data
2975
2980
2976
2981
return tensor .from_function (unit_uniform , shape )
0 commit comments