You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError('invalid argument. First argument specifies an unexpected number of types. Two input ndarray data types must be specified for each provided strided function.');
178
179
}
179
-
this._idtypes=idtypes;
180
-
this._odtypes=odtypes;
180
+
this._idtypes=idt;
181
+
this._odtypes=odt;
181
182
this._policies={
182
183
'output': policies.output,
183
184
'casting': policies.casting
@@ -240,6 +241,8 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'apply', function apply( x, y )
240
241
varordx;
241
242
varordy;
242
243
varordz;
244
+
varxdte;
245
+
varydte;
243
246
varerr;
244
247
varidx;
245
248
varshx;
@@ -265,12 +268,14 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'apply', function apply( x, y )
265
268
thrownewTypeError(format('invalid argument. Second argument must be an ndarray-like object. Value: `%s`.',y));
266
269
}
267
270
xdt=getDType(x);
268
-
if(!contains(this._idtypes[0],resolveStr(xdt))){
269
-
thrownewTypeError(format('invalid argument. First argument must have one of the following data types: "%s". Data type: `%s`.',join(this._idtypes[0],'", "'),xdt));
271
+
xdte=resolveEnum(xdt);
272
+
if(!contains(this._idtypes[0],xdte)){
273
+
thrownewTypeError(format('invalid argument. First argument must have one of the following data types: "%s". Data type: `%s`.',join(dtypes2strings(this._idtypes[0]),'", "'),xdt));
270
274
}
271
275
ydt=getDType(y);
272
-
if(!contains(this._idtypes[1],resolveStr(ydt))){
273
-
thrownewTypeError(format('invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.',join(this._idtypes[1],'", "'),ydt));
276
+
ydte=resolveEnum(ydt);
277
+
if(!contains(this._idtypes[1],ydte)){
278
+
thrownewTypeError(format('invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.',join(dtypes2strings(this._idtypes[1]),'", "'),ydt));
274
279
}
275
280
args=[x,y];
276
281
for(i=2;i<nargs;i++){
@@ -279,10 +284,10 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'apply', function apply( x, y )
279
284
break;
280
285
}
281
286
dt=getDType(arr);
282
-
if(!contains(this._idtypes[i],resolveStr(dt))){
283
-
thrownewTypeError(format('invalid argument. Argument %d must have one of the following data types: "%s". Data type: `%s`.',i,join(this._idtypes[i],'", "'),dt));
287
+
if(!contains(this._idtypes[i],resolveEnum(dt))){
288
+
thrownewTypeError(format('invalid argument. Argument %d must have one of the following data types: "%s". Data type: `%s`.',i,join(dtypes2strings(this._idtypes[i]),'", "'),dt));
284
289
}
285
-
// Note: we don't type promote additional ndarray arguments, as they are passed as scalars to the underlying strided reduction function...
290
+
// Note: we don't type promote additional ndarray arguments...
286
291
args.push(arr);
287
292
}
288
293
// If we didn't make it up until the last argument, this means that we found a non-options argument which was not an ndarray...
@@ -338,23 +343,23 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'apply', function apply( x, y )
338
343
339
344
// Determine whether we need to cast the input ndarrays...
@@ -430,6 +435,8 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'assign', function assign( x, y
430
435
varnargs;
431
436
varopts;
432
437
varargs;
438
+
varxdte;
439
+
varydte;
433
440
vararr;
434
441
varerr;
435
442
varflg;
@@ -455,12 +462,14 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'assign', function assign( x, y
455
462
}
456
463
// Validate the input ndarray data types in order to maintain similar behavior to `apply` above...
457
464
xdt=getDType(x);
458
-
if(!contains(this._idtypes[0],resolveStr(xdt))){
459
-
thrownewTypeError(format('invalid argument. First argument must have one of the following data types: "%s". Data type: `%s`.',join(this._idtypes[0],'", "'),xdt));
465
+
xdte=resolveEnum(xdt);
466
+
if(!contains(this._idtypes[0],xdte)){
467
+
thrownewTypeError(format('invalid argument. First argument must have one of the following data types: "%s". Data type: `%s`.',join(dtypes2strings(this._idtypes[0]),'", "'),xdt));
460
468
}
461
469
ydt=getDType(y);
462
-
if(!contains(this._idtypes[1],resolveStr(ydt))){
463
-
thrownewTypeError(format('invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.',join(this._idtypes[1],'", "'),ydt));
470
+
ydte=resolveEnum(ydt);
471
+
if(!contains(this._idtypes[1],ydte)){
472
+
thrownewTypeError(format('invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.',join(dtypes2strings(this._idtypes[1]),'", "'),ydt));
464
473
}
465
474
// Verify that both input arrays have the same shape:
466
475
shx=getShape(x);
@@ -500,11 +509,11 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'assign', function assign( x, y
500
509
// Cache a reference to the output ndarray:
501
510
z=args.pop();
502
511
503
-
// Verify that additional ndarray arguments have expected dtypes (note: we intentionally don't validate the output ndarray dtype in order to provide an escape hatch for a user wanting to have an output ndarray having a specific dtype that `apply` does not support; note: we don't type promote additional ndarray arguments, as they are passed as scalars to the underlying strided reduction function)...
512
+
// Verify that additional ndarray arguments have expected dtypes (note: we intentionally don't validate the output ndarray dtype in order to provide an escape hatch for a user wanting to have an output ndarray having a specific dtype that `apply` does not support; note: we don't type promote additional ndarray arguments)...
504
513
for(i=2;i<args.length;i++){
505
514
dt=getDType(args[i]);
506
-
if(!contains(this._idtypes[i],resolveStr(dt))){
507
-
thrownewTypeError(format('invalid argument. Argument %d must have one of the following data types: "%s". Data type: `%s`.',i,join(this._idtypes[i],'", "'),dt));
515
+
if(!contains(this._idtypes[i],resolveEnum(dt))){
516
+
thrownewTypeError(format('invalid argument. Argument %d must have one of the following data types: "%s". Data type: `%s`.',i,join(dtypes2strings(this._idtypes[i]),'", "'),dt));
508
517
}
509
518
}
510
519
// Validate any provided options...
@@ -523,23 +532,23 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'assign', function assign( x, y
523
532
// Determine whether we need to cast the input ndarrays...
returnnewTypeError(format('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.','dtype',join(dtypes,'", "'),options.dtype));
89
+
opts.dtype=options.dtype;
90
+
if(!contains(dtypes,resolveEnum(opts.dtype))){
91
+
returnnewTypeError(format('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.','dtype',join(dtypes2strings(dtypes),'", "'),options.dtype));
0 commit comments