-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[clojure][generator][WIP] add random namespace generation #14750
Conversation
* `ndarray_random_api` * `symbol_random_api`
cc @kedarbellare :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a great start! there are a few things to change:
- DRY the code a bit (to share as much as possible between symbol/ndarray api and random api)
- call the scala
SymbolRandomAPI
andNDArrayRandomAPI
- unify the
random_
andsample_
methods (and remove them from the ndarray/symbol api namespaces) - add unit tests
|
||
(defn gen-symbol-random-api-function [op-name] | ||
(let [{:keys [fn-name fn-description args]} (gen-op-info op-name) | ||
fn-name (remove-prefix "-random-" fn-name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the scala package does it for both random_
and sample_
(see: https://github.com/apache/incubator-mxnet/blob/master/scala-package/macros/src/main/scala/org/apache/mxnet/GeneratorBase.scala#L180).
get apply shuffle ref]) | ||
(:require [org.apache.clojure-mxnet.util :as util] | ||
[org.apache.clojure-mxnet.shape :as mx-shape]) | ||
(:import (org.apache.mxnet SymbolAPI)))") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use the SymbolRandomAPI
instead (see: http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.SymbolRandomAPI$)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not get it to work. Do you have any pointers on how this should be done?
|
cc @gigasquid for feedback on the |
I reopened a PR here: #14800 |
@mxnet-label-bot add [Clojure, pr-work-in-progress] |
PR moved here: #14800
Description
Split random functions in their own generated namespace.
ndarray_random_api
symbol_random_api
It renames the following functions to be as close as possible to the scala names:
-random-randint
intorandint
sample-randint
intorandint-like
for instance and put them underndarray-random-api
namespace.TODO
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments