deeplearning4j-examples icon indicating copy to clipboard operation
deeplearning4j-examples copied to clipboard

get different values when run Ex2_LinearRegression.java in many times

Open bewithme opened this issue 3 years ago • 1 comments

Issue Description

Please describe your issue, along with:

in this example https://github.com/eclipse/deeplearning4j-examples/blob/master/samediff-examples/src/main/java/org/nd4j/examples/samediff/quickstart/basics/Ex2_LinearRegression.java why gradMap.get("weights") and gradMap.get("bias") return me different value when I run it in many times ?

  • expected gradMap.get("weights") and gradMap.get("bias") return the same values when run it in many times
  • encountered gradMap.get("weights") and gradMap.get("bias") return me different values when run it in many times

Version Information

Please indicate relevant versions, including, if relevant:

  • Deeplearning4j version: beta7
  • platform information (OS, etc): mac OS10.15.6
  • CUDA version, if used: None
  • NVIDIA driver version, if in use: None

bewithme avatar Dec 01 '20 09:12 bewithme

What you are seeing is just the effect of no fixed random seed. The weights get initialized randomly on each run of the example, you get different gradients on each run.

treo avatar Dec 01 '20 10:12 treo