mohawk2 opened a new issue #20851: URL: https://github.com/apache/incubator-mxnet/issues/20851
## Description @sergeykolychev This code shows hardcoded type-numbers (https://github.com/apache/incubator-mxnet/blob/v1.x/perl-package/AI-MXNet/lib/AI/MXNet/Base.pm#L62-L84): ```perl use constant DTYPE_MX_TO_PDL => { 0 => 6, 1 => 7, 2 => 6, 3 => 0, 4 => 3, 5 => 0, 6 => 5, float32 => 6, float64 => 7, float16 => 6, uint8 => 0, int32 => 3, int8 => 0, int64 => 5 }; ``` but PDL since 2.064 has changed these numbers due to an increased number of integer types, and the floating-point types needing to all be above all the integer types. This is the same problem as https://github.com/apache/incubator-mxnet/issues/20850 which can be closed. ### Error Message Code below prints [5,0] instead of [5, 9]. ## To Reproduce From https://github.com/PDLPorters/pdl/issues/377: ```perl use strict; use warnings; use AI::MXNet qw(mx); use AI::MXNet qw(nd); my $x = mx->nd->array([5, 9]); print $x->aspdl; ``` ### Steps to reproduce Run the above Perl code. ## What have you tried to solve it? Instead the code (one way only) should be something like this in order to work on all recent-ish version of PDL (both before and after the added types, though `sbyte` is new and would need to be either adjusted for lower-versioned PDL, or simply a dependency on PDL 2.064 added): ```perl use constant DTYPE_MX_TO_PDL => { 0 => PDL::Type->new('float')->enum, 1 => PDL::Type->new('double')->enum, # half-precision is not supported by PDL and this would cause chaos # 2 => , 3 => PDL::Type->new('byte')->enum, 4 => PDL::Type->new('long')->enum, 5 => PDL::Type->new('sbyte')->enum, 6 => PDL::Type->new('longlong')->enum, float32 => PDL::Type->new('float')->enum, float64 => PDL::Type->new('double')->enum, # half-precision is not supported by PDL and this would cause chaos # float16 => , uint8 => PDL::Type->new('byte')->enum, int32 => PDL::Type->new('long')->enum, int8 => PDL::Type->new('sbyte')->enum, int64 => PDL::Type->new('longlong')->enum, }; ``` ## Environment Perl 5.32, CPAN AI::MXNet 1.5, PDL 2.068. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
