tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

build(deps): bump msgpackr from 1.5.5 to 1.10.1 in /tfjs-automl/demo/img_classification

Open dependabot[bot] opened this issue 2 years ago • 0 comments

Bumps msgpackr from 1.5.5 to 1.10.1.

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.

dependabot[bot] avatar Dec 28 '23 21:12 dependabot[bot]

That does seem poor... But you are ignoring this warning:

warning: passing floating-point values to sym is dangerous, see "help sym"

Compare the difference between these:

1e-23*x
warning: passing floating-point values to sym is dangerous, see "help sym"
warning: called from
    double_to_sym_heuristic at line 50 column 7
    sym at line 379 column 13
    mtimes at line 54 column 5

ans = (sym)
           x         
  ───────────────────
  9223372036854775807


octave:28> sym(1)*sym(10)^(-23)*x
ans = (sym)
             x            
  ────────────────────────
  100000000000000000000000

cbm755 avatar Sep 14 '23 05:09 cbm755

I'm not sure if this can be improved but the root of this problem is the following. I've hidden most of the warnings, but I re-iterate that converting doubles to sym is a bad idea, that's what the warning is telling us.

> sym(1e-15)
warning: passing floating-point values to sym is dangerous, see "help sym"
ans = (sym) 1/1000000000000000

> sym(1e-16)
warning: passing floating-point values to sym is dangerous, see "help sym"
ans = (sym) 1/10000000000000000

> sym(1e-17)
warning: passing floating-point values to sym is dangerous, see "help sym"
ans = (sym) 1/100000000000000000

> sym(1e-18)
warning: passing floating-point values to sym is dangerous, see "help sym"
ans = (sym) 1/999999999999999872

> sym(1e-19)
warning: passing floating-point values to sym is dangerous, see "help sym"
ans = (sym) 1/9223372036854775807

> sym(1e-20)
warning: passing floating-point values to sym is dangerous, see "help sym"
ans = (sym) 1/9223372036854775807

cbm755 avatar Sep 14 '23 05:09 cbm755

This 9223372036854775807 number is 2^63 - 1: presumably a int64 is being created somewhere along the way... Python int's have no max but int64 or uint64 certainly do...

cbm755 avatar Sep 14 '23 05:09 cbm755

Using ratflag as f is working fine:

sym(1e-23, 'f')
ans = (sym)
              6805647338418769           
  ───────────────────────────────────────
  680564733841876926926749214863536422912

So I tracked this to @sym/private/double_to_sym_heuristic.m:

    [N1, D1] = rat (x);
    [N2, D2] = rat (x / pi);
    N3 = round (x^2);
    err1 = abs (N1 / D1 - x);
    err2 = abs ((N2*pi) / D2 - x);
    err3 = abs (sqrt (N3) - x);
    if (err1 <= err3)
      if (err1 <= err2)
        y = pycall_sympy__ ('return Rational(*_ins)', int64 (N1), int64 (D1));
      else
        y = pycall_sympy__ ('return Rational(*_ins)*S.Pi', int64 (N2), int64 (D2));
      end
    else
      y = pycall_sympy__ ('return sqrt(Integer(*_ins))', int64 (N3));
    end

observations

  • Lots of double precision calculations being done there
  • none of those err calculations are accurate at these scales
  • values being passed are limited to int64

decisions to be made

  • since its a heuristic function, perhaps there should be a hardcoded range where the heuristics are applied...
  • outside of that range, either an error or better yet fall back on ratflag 'f'
  • and/or go back to rats: IIRC it was worse, but it would give a string.

cbm755 avatar Sep 14 '23 07:09 cbm755