tlby commented on a change in pull request #9988: [Perl] Sparse feature.
URL: https://github.com/apache/incubator-mxnet/pull/9988#discussion_r172404489
 
 

 ##########
 File path: perl-package/AI-MXNet/lib/AI/MXNet/Base.pm
 ##########
 @@ -365,4 +452,20 @@ $PDL::toolongtoprint = 1000_000_000;
     *PDL::dtype  = sub { DTYPE_MX_TO_STR->{ DTYPE_PDL_TO_MX->{ 
shift->type->numval } } };
 }
 
+sub digitize
+{
+    my ($d, $bins) = @_;
+    for(my $i = 0; $i < @$bins; $i++)
+    {
+        return $i if $d < $bins->[$i];
+    }
+    return scalar(@$bins);
+}
+
+use B;
+sub hash { hex(B::hash(shift)) }
 
 Review comment:
   Careful with this, 
[remember](https://perldoc.perl.org/perl5180delta.html#Hash-overhaul) the hash 
produced will vary from one run to the next.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to