mdespriee edited a comment on issue #12489: [WIP][MXNET-918] Random api URL: https://github.com/apache/incubator-mxnet/pull/12489#issuecomment-433446673 @lanking520 Here is an updated PR. Still unfinished (see below), but you can give me your feedback on what's done so far. - First I quite largely refactored the macros to factorize code, because I was annoyed with the code duplication. Tell me what you think (it's done in commit https://github.com/apache/incubator-mxnet/pull/12489/commits/6cbd132f3703df80a42b273cc9691047a938dfce) - Now, we have the Symbol.Random and NDArray.Random module accepting Any, and routing to the right implementation. See generated code: https://gist.github.com/mdespriee/4b170ebf4dd52df90f30579e3aac510b and https://gist.github.com/mdespriee/ced69d2b38b6aec8f192e0ec325f8e7e - Unfortunately, at run-time it's rejected with errors like this: ``` org.apache.mxnet.MXNetError: Cannot find argument 'lam', Possible Arguments: ---------------- shape : Shape(tuple), optional, default=[] Shape to be sampled from each random distribution. dtype : {'None', 'float16', 'float32', 'float64'},optional, default='None' DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). , in operator _sample_poisson(name="", shape="(2,2)", lam="1.0") at org.apache.mxnet.Base$.checkCall(Base.scala:131) at org.apache.mxnet.Symbol$.createFromNamedSymbols(Symbol.scala:1178) at org.apache.mxnet.Symbol$.createSymbolGeneral(Symbol.scala:1106) at org.apache.mxnet.SymbolRandomAPI$.poisson(SymbolAPI.scala:12) ``` I'm investigating that. Any hint welcome ! - Also, we have compilation warnings (in macro-generated code) about code erasure. Eg: ``` [WARNING] <macro>:4: warning: non-variable type argument org.apache.mxnet.NDArray in type pattern Option[org.apache.mxnet.NDArray] is unchecked since it is eliminated by erasure [INFO] case _:Option[org.apache.mxnet.NDArray] => "sample_normal" ``` I'm unsure how to fix this. Some attempts with ClassTag stuff didn't work. Still trying.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
