Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RandomNormal: Graph failed to execute: Execute: input #0 of node #14 is not calculated yet #197

@richiejp

Description

@richiejp

When using RandomNormal I get the following error:

panic: Graph failed to execute: Execute: input #0 of node #14 is not calculated yet (!?) -- this is a bug, it should never have happened

goroutine 1 [running]:
github.com/gomlx/gomlx/graph.(*Graph).RunWithBuffers(0xc0001b6000, {0xc0001be2b0, 0x1, 0x1}, {0xc0001f62e8, 0x1, 0x1})
	/home/rich/go/pkg/mod/github.com/gomlx/[email protected]/graph/graph.go:540 +0x3e7
github.com/gomlx/gomlx/graph.(*Exec).compileAndExecute(0xc0000ec2d0, 0x1, {0xc0001e5eb8?, 0x7bb300?, 0x1?})
	/home/rich/go/pkg/mod/github.com/gomlx/[email protected]/graph/exec.go:507 +0x573
github.com/gomlx/gomlx/graph.(*Exec).CallWithGraph(...)
	/home/rich/go/pkg/mod/github.com/gomlx/[email protected]/graph/exec.go:418
github.com/gomlx/gomlx/graph.(*Exec).Call(0x88a4d8?, {0xc0001e5eb8?, 0x79c020?, 0xc0001f62f0?})
	/home/rich/go/pkg/mod/github.com/gomlx/[email protected]/graph/exec.go:387 +0x27
main.main()
	 [[ Cell [33] Line 40 ]] /tmp/gonb_f89ccf3d/main.go:49 +0x3b7
exit status 2

You can see the full code here (scroll to bottom): https://github.com/richiejp/makemore-go/blob/f8fa21a56c4501d846375f173cb11cec323e38d1/makemore.ipynb

I narrowed down the bug to using the updated RNG state, I'm able to work around the bug with the following redefinition:

func MyRandomNormal(rngState *Node, shape shapes.Shape) (newRngState, values *Node) {
  g := rngState.Graph()
  var u1, u2 *Node
  newRngState, u1 = RandomUniform(rngState, shape)
  u1 = Max(u1, Const(g, shape.DType.SmallestNonZeroValueForDType()))

  newRngState = Const(g, RngStateFromSeed(42))
  newRngState, u2 = RandomUniform(newRngState, shape)

  values = Mul(
    Sqrt(MulScalar(Log(u1), -2)),
    Cos(MulScalar(u2, 2*math.Pi)))
  return
}

I'm executing under the Go backend.

Thanks for creating this project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions