File tree 1 file changed +9
-6
lines changed
lib/node_modules/@stdlib/ndarray/zeros-like/lib
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
28
28
var strides2offset = require ( '@stdlib/ndarray/base/strides2offset' ) ;
29
29
var buffer = require ( '@stdlib/ndarray/base/buffer' ) ;
30
30
var numel = require ( '@stdlib/ndarray/base/numel' ) ;
31
+ var getDType = require ( '@stdlib/ndarray/dtype' ) ;
32
+ var getShape = require ( '@stdlib/ndarray/shape' ) ;
33
+ var getOrder = require ( '@stdlib/ndarray/order' ) ;
31
34
var ndarray = require ( '@stdlib/ndarray/ctor' ) ;
32
35
var format = require ( '@stdlib/string/format' ) ;
33
36
@@ -91,7 +94,7 @@ function zerosLike( x ) {
91
94
if ( hasOwnProp ( options , 'dtype' ) ) {
92
95
dtype = options . dtype ;
93
96
} else {
94
- dtype = x . dtype ;
97
+ dtype = getDType ( x ) ;
95
98
}
96
99
if ( hasOwnProp ( options , 'shape' ) ) {
97
100
sh = options . shape ;
@@ -102,12 +105,12 @@ function zerosLike( x ) {
102
105
throw new TypeError ( format ( 'invalid option. `%s` option must be a nonnegative integer or an array of nonnegative integers. Option: `%s`.' , 'shape' , sh ) ) ;
103
106
}
104
107
} else {
105
- sh = x . shape ;
108
+ sh = getShape ( x ) ;
106
109
}
107
110
if ( hasOwnProp ( options , 'order' ) ) {
108
111
order = options . order ;
109
112
} else {
110
- order = x . order ;
113
+ order = getOrder ( x ) ;
111
114
}
112
115
if ( hasOwnProp ( options , 'mode' ) ) {
113
116
opts . mode = options . mode ;
@@ -119,9 +122,9 @@ function zerosLike( x ) {
119
122
opts . readonly = options . readonly ;
120
123
}
121
124
} else {
122
- dtype = x . dtype ;
123
- sh = x . shape ;
124
- order = x . order ;
125
+ dtype = getDType ( x ) ;
126
+ sh = getShape ( x ) ;
127
+ order = getOrder ( x ) ;
125
128
}
126
129
ndims = sh . length ;
127
130
if ( ndims > 0 ) {
You can’t perform that action at this time.
0 commit comments