Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Impossible to provide arguments to random_normal in scala ? #12140

Description

@mdespriee

Description

I'm trying to use random_normal in the Symbol API. In scala.
The docs mentions that loc and scale could be Symbols and have a shape (that's what I'm looking for). Although, when I try to use the symbol:

val mean:Symbol...
val std:Symbol...
Symbol.random_normal(i.output)(mean, std)()

MXNet complains that arguments are incorrect.

org.apache.mxnet.MXNetError: [23:24:15] src/core/symbolic.cc:290: Check failed: args.size() <= n_req (2 vs. 0) Incorrect number of arguments, requires 0, provided 2

Sounds like a bug to me. Or do I miss something ?

Environment

Full code

object NormalTest extends App {
  val mean = Symbol.Variable("mean")
  val std = Symbol.Variable("std")
  val s = Symbol.random_normal("gaussian")(mean, std)()

  val exec = s.bind(Context.defaultCtx, Map(
    "mean" -> NDArray.array(Array(0f, 10f), Shape(2)),
    "std" -> NDArray.array(Array(1f, 2f), Shape(2))
  ))

  exec.forward()
  println(s"Result= ${exec.outputs.head.toArray.mkString(",")} ")
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions