Uploaded image for project: 'SystemDS'
  1. SystemDS
  2. SYSTEMDS-1621

`max(0, X)` fails with type mismatch

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • SystemML 0.15
    • None
    • None

    Description

      Scenario: Compute the element-wise max of a matrix X and 0.

      Current behavior: max(0, X) fails, max(0.0, X) works, and max(X, 0) works as well.

      Desired behavior: max(0, X) should work.

      How to reproduce: nn/layers/relu.dml::forward currently contains a max(X, 0) function call. When the tests (test/integration/scripts/nn/NNTest.java) are run, everything works fine. However, if this function is adjusted to be max(0, X), the tests will fail during parsing with the following error:

      17/05/23 11:17:00 ERROR parser.StatementBlock: ERROR: ./nn/test/grad_check.dml -- line 1729, column 2 -- for function two_layer_affine_l2_net_forward, return variable aout value type of INT does not match value type in function signature of DOUBLE and cannot safely cast double as int
      17/05/23 11:17:00 ERROR api.DMLScript: Failed to execute DML script.
      org.apache.sysml.parser.LanguageException: ERROR: ./nn/test/grad_check.dml -- line 1729, column 2 -- for function two_layer_affine_l2_net_forward, return variable aout value type of INT does not match value type in function signature of DOUBLE and cannot safely cast INT as DOUBLE
              at org.apache.sysml.parser.FunctionStatementBlock.validate(FunctionStatementBlock.java:155)
              at org.apache.sysml.parser.DMLTranslator.validateParseTree(DMLTranslator.java:133)
              at org.apache.sysml.api.DMLScript.execute(DMLScript.java:758)
              at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:506)
              at org.apache.sysml.api.DMLScript.main(DMLScript.java:233)
      Exception in thread "main" org.apache.sysml.api.DMLException: org.apache.sysml.parser.LanguageException: ERROR: ./nn/test/grad_check.dml -- line 1729, column 2 -- for function two_layer_affine_l2_net_forward, return variable aout value type of INT does not match value type in function signature of DOUBLE and cannot safely cast INT as DOUBLE
              at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:533)
              at org.apache.sysml.api.DMLScript.main(DMLScript.java:233)
      Caused by: org.apache.sysml.parser.LanguageException: ERROR: ./nn/test/grad_check.dml -- line 1729, column 2 -- for function two_layer_affine_l2_net_forward, return variable aout value type of INT does not match value type in function signature of DOUBLE and cannot safely cast INT as DOUBLE
              at org.apache.sysml.parser.FunctionStatementBlock.validate(FunctionStatementBlock.java:155)
              at org.apache.sysml.parser.DMLTranslator.validateParseTree(DMLTranslator.java:133)
              at org.apache.sysml.api.DMLScript.execute(DMLScript.java:758)
              at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:506)
              ... 1 more
      Failed to run SystemML. Exit code :256
      

      Attachments

        Issue Links

          Activity

            People

              mboehm7 Matthias Boehm
              dusenberrymw Mike Dusenberry
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: