Commit d290881
Tensor extensions (#4260)
* Add TensorTypeExtensions
* Upgrade performance by replacing ToArray method
* Fix failing tests
* Remove unused code
* Remove duplicate file TensorTypeExtensions
* Remove comented code
* Add exceptions
* Add copyright header
* Rename ToSpan to CopyTo
* Use Utils.EnsureSize method
* Use CopyTo method to copy the values to span
* Fix Destination too short error
* Call CopyTo inside ToArray method to ensure code reuse
* No need to assign values span to dst
* Use checked keyword around cast to len
* Set keepOld to false instead of true in Utils.EnsureSize
* Add assert to ensure that imageArray and featurizedImage are the same size
* Cast tensor.size to int instead of long
* Remove FetchData since it's no longer used
* Add checked keyword around cast1 parent 4088620 commit d290881
File tree
5 files changed
+82
-27
lines changed- src
- Microsoft.ML.Dnn
- Microsoft.ML.TensorFlow
5 files changed
+82
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
383 | | - | |
| 382 | + | |
| 383 | + | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
389 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
390 | 394 | | |
391 | 395 | | |
392 | 396 | | |
| |||
871 | 875 | | |
872 | 876 | | |
873 | 877 | | |
874 | | - | |
| 878 | + | |
875 | 879 | | |
876 | 880 | | |
877 | 881 | | |
| |||
903 | 907 | | |
904 | 908 | | |
905 | 909 | | |
906 | | - | |
| 910 | + | |
907 | 911 | | |
908 | 912 | | |
909 | 913 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | 280 | | |
289 | 281 | | |
290 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
245 | | - | |
246 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
247 | 250 | | |
248 | 251 | | |
249 | 252 | | |
| |||
338 | 341 | | |
339 | 342 | | |
340 | 343 | | |
| 344 | + | |
| 345 | + | |
341 | 346 | | |
342 | 347 | | |
343 | 348 | | |
| |||
378 | 383 | | |
379 | 384 | | |
380 | 385 | | |
381 | | - | |
382 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
383 | 390 | | |
384 | 391 | | |
385 | 392 | | |
| |||
429 | 436 | | |
430 | 437 | | |
431 | 438 | | |
432 | | - | |
| 439 | + | |
| 440 | + | |
433 | 441 | | |
434 | 442 | | |
435 | 443 | | |
| |||
799 | 807 | | |
800 | 808 | | |
801 | 809 | | |
802 | | - | |
803 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
804 | 814 | | |
805 | 815 | | |
806 | 816 | | |
| |||
826 | 836 | | |
827 | 837 | | |
828 | 838 | | |
829 | | - | |
830 | | - | |
| 839 | + | |
| 840 | + | |
831 | 841 | | |
832 | 842 | | |
833 | 843 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
596 | | - | |
597 | 596 | | |
598 | 597 | | |
599 | 598 | | |
600 | 599 | | |
601 | 600 | | |
602 | | - | |
603 | 601 | | |
604 | | - | |
| 602 | + | |
605 | 603 | | |
606 | 604 | | |
607 | 605 | | |
| |||
633 | 631 | | |
634 | 632 | | |
635 | 633 | | |
636 | | - | |
| 634 | + | |
637 | 635 | | |
638 | 636 | | |
639 | 637 | | |
| |||
0 commit comments