rahuljo commented on code in PR #1848:
URL: https://github.com/apache/systemds/pull/1848#discussion_r1257740404


##########
src/main/python/tests/nn/test_relu.py:
##########
@@ -37,29 +34,40 @@ class TestRelu(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
         cls.sds = SystemDSContext()
+        cls.X = np.array([0, -1, -2, 2, 3, -5])
+        cls.dout = np.array([0, 1, 2, 3, 4, 5])
 
     @classmethod
     def tearDownClass(cls):
         cls.sds.close()
 
     def test_forward(self):
-        relu = ReLU()
-        #forward
-        Xm = self.sds.from_numpy(X)
+        relu = ReLU(self.sds)
+        # forward
+        Xm = self.sds.from_numpy(self.X)
         out = relu.forward(Xm).compute().flatten()

Review Comment:
   I get the following error at this step:
   ```
   line 1:7 token recognition error at: '"C:\U'
   line 1:16 token recognition error at: '\'
   23/07/09 20:20:06 ERROR api.DMLScript: line 1:12 mismatched input 'sers' 
expecting STRING ([@2,12:15='sers',<60>,1:12])
   line 1:22 token recognition error at: '\'
   line 1:35 token recognition error at: '\'
   line 1:40 token recognition error at: '\'
   line 1:49 token recognition error at: '\'
   line 1:57 token recognition error at: '\'
   line 1:60 token recognition error at: '\'
   line 1:67 token recognition error at: '\'
   line 1:72 token recognition error at: '.d'
   line 1:76 token recognition error at: '") as 
relu\nV1=read('./tmp/V1',rows=6,cols=1);\nV2=relu::forward(X=V1);\nwrite(V2, 
'./tmp');\n'
   Traceback (most recent call last):
     File 
"C:\Users\rahul\IdeaProjects\AMLS\systemds\src\main\python\systemds\operator\nn\relu.py",
 line 83, in <module>
       print(ReLU.forward(X).compute())
     File 
"C:\Users\rahul\IdeaProjects\AMLS\systemds\src\main\python\systemds\operator\nodes\matrix.py",
 line 74, in compute
       return super().compute(verbose, lineage)
     File 
"C:\Users\rahul\IdeaProjects\AMLS\systemds\src\main\python\systemds\operator\operation_node.py",
 line 103, in compute
       result_variables = self._script.execute()
     File 
"C:\Users\rahul\IdeaProjects\AMLS\systemds\src\main\python\systemds\script_building\script.py",
 line 89, in execute
       self.sds_context.exception_and_close(exception_str, trace_back_limit)
     File 
"C:\Users\rahul\IdeaProjects\AMLS\systemds\src\main\python\systemds\context\systemds_context.py",
 line 132, in exception_and_close
       raise RuntimeError(message)
   RuntimeError: 
   
   An error occurred while calling o1.prepareScript.
   : org.apache.sysds.api.DMLException: java.lang.NullPointerException
        at 
org.apache.sysds.api.jmlc.Connection.prepareScript(Connection.java:284)
        at 
org.apache.sysds.api.jmlc.Connection.prepareScript(Connection.java:223)
        at 
org.apache.sysds.api.jmlc.Connection.prepareScript(Connection.java:210)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
        at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
        at py4j.Gateway.invoke(Gateway.java:282)
        at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
        at py4j.commands.CallCommand.execute(CallCommand.java:79)
        at py4j.GatewayConnection.run(GatewayConnection.java:238)
        at java.base/java.lang.Thread.run(Thread.java:834)
   Caused by: java.lang.NullPointerException
        at 
org.apache.sysds.parser.dml.DmlSyntacticValidator.exitImportStatement(DmlSyntacticValidator.java:462)
        at 
org.apache.sysds.parser.dml.DmlParser$ImportStatementContext.exitRule(DmlParser.java:379)
        at 
org.antlr.v4.runtime.tree.ParseTreeWalker.exitRule(ParseTreeWalker.java:47)
        at 
org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:30)
        at 
org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)
        at 
org.apache.sysds.parser.dml.DMLParserWrapper.doParse(DMLParserWrapper.java:177)
        at 
org.apache.sysds.parser.dml.DMLParserWrapper.parse(DMLParserWrapper.java:89)
        at 
org.apache.sysds.api.jmlc.Connection.prepareScript(Connection.java:256)
        ... 13 more
   ```
   
   I think the problem is that when `ReLU.forward().compute()` is called, then 
it tries to execute: 
   ```
   
source("C:\Users\rahul\IdeaProjects\AMLS\systemds\scripts\nn\layers\relu.dml") 
as relu
   V1=read('./tmp/V1',rows=6,cols=1);
   V2=relu::forward(X=V1);
   write(V2, './tmp');
   ```
   and this might be failing because of the backslashes in the path.
   @Baunsgaard Any idea on how I can fix this?
   



-- 
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: dev-unsubscr...@systemds.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to