From dev-return-2726-archive-asf-public=cust-asf.ponee.io@mxnet.incubator.apache.org Wed May 2 03:50:29 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E1D60180645 for ; Wed, 2 May 2018 03:50:28 +0200 (CEST) Received: (qmail 13148 invoked by uid 500); 2 May 2018 01:50:27 -0000 Mailing-List: contact dev-help@mxnet.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mxnet.incubator.apache.org Delivered-To: mailing list dev@mxnet.incubator.apache.org Received: (qmail 13127 invoked by uid 99); 2 May 2018 01:50:26 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 May 2018 01:50:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 3EB3E180709 for ; Wed, 2 May 2018 01:50:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=googlemail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id kWOC9b8HTarg for ; Wed, 2 May 2018 01:50:23 +0000 (UTC) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 145B45FB3B for ; Wed, 2 May 2018 01:50:23 +0000 (UTC) Received: by mail-lf0-f54.google.com with SMTP id y14-v6so18154315lfy.12 for ; Tue, 01 May 2018 18:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=yBX/CHQZFW7EhookyX5PC0wq8xxDVqKFOwMVE59oVUE=; b=ttnGJycD6cpxpQ4AZl6IatS0gAXnobrELCwCELpeW4YmTo7M0n58cy2EY/rL6xYLd2 Czqe1By4r4pLaTEuNl/R/Z+Er+snnMstuhIfRUK0JMyK699p4SxmznlHdstzbyxgpOr/ GrhSmX3TVNJS9BjnCAcuo8cYO1QxAFozm+19ePu4kSZoMjHWvWg2mNIp1qTCWSzoLRiL vgtcy9cgMFUS18BYu8ZOWJ6PCMZ3ltMMnisPLEbfMLSYhFZ7hoRURISmrHFyXnyVJwul nGs8kMmNcKQR7g9wJ37Xvgkq4dH2+FiSqzMPYSWhAcsQjv3A7Opgwr3KFscv4od8/hfQ /rkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=yBX/CHQZFW7EhookyX5PC0wq8xxDVqKFOwMVE59oVUE=; b=oxETWXGOXBL6aMziflwPq+xlw0uIgbPpnbsR1zmHXYMFG22AqG1GoeERxJjSK3luO9 1xxWHoFMRs8a7StVBm/x1m64GID9PJYHMIjffx4+DaQTcua6pYC4jgVJ3dBigmLmNkwq 9+nQ0/lpYDvrf7ciAphyn0nhWfJok7yWR/1NCaYizN6dMSklWaGwHmnXd7MCv2TXWICv oDPpu4oNDyV/8UC+Z6UdQ6qgnH/tt876+eqvJspX88OH3l2S6bokWdRTCgQl5BtJ7nKP JJ7MMJ7I8NMaslk0kYMqDgOR1rWhD85v9dlvONp2Bs3gzCMKH1t2XF7VuiBpLyExTyw4 Xv7g== X-Gm-Message-State: ALQs6tCm0+jfUF+CxCUmOjj5s/R4vFxvrPU2o0ZvNtrDGP/02ZY6vwnz xEm89g5UxScdpm5U0zTX7/iQTF0v4w5M/9ONGV8= X-Google-Smtp-Source: AB8JxZoXTyh8zBsXcw9ymFR+hXjT3iKgXhLOk/qmhqLvI79QpaQ2iOu0awhvDyxDEDDjFVg6ONB+41llT+aAzgYhq5I= X-Received: by 2002:a2e:9656:: with SMTP id z22-v6mr11432170ljh.127.1525225822204; Tue, 01 May 2018 18:50:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:9a10:0:0:0:0:0 with HTTP; Tue, 1 May 2018 18:49:41 -0700 (PDT) In-Reply-To: References: From: Marco de Abreu Date: Wed, 2 May 2018 03:49:41 +0200 Message-ID: Subject: Re: The New Scala API To: dev@mxnet.incubator.apache.org Content-Type: multipart/alternative; boundary="00000000000055b6ce056b2f4fed" --00000000000055b6ce056b2f4fed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey Naveen, I'm not familiar with Scala, so please correct me if I'm wrong with my assumptions. This basically sounds like we'd have an interface for the Scala API and a separate implementation, right? In general, I really like these decoupled approaches (you already highlighted the advantages)! It would introduce a small overhead since we'd have to define the traits and implementation at two (different) locations, but it definitely increases clarity and separates concerns. I don't think we will have multiple implementations in future, but this might allow us to define the user-facing API in form of traits while allowing us to change the underlying "glue" as we want. My only slight concern is that this would introduce a bit more overhead since the documentation and API are defined somewhere else, but I have no experience with Scala, so I'll leave this up to the people who are more familiar with the topic. Best regards, Marco On Tue, May 1, 2018 at 11:48 PM, Naveen Swamy wrote: > I think this project is going to significantly improve the usability of > MXNet-Scala APIs. > > I had a offline discussion with Qing about this. I agree with Yizhi that > keeping in the same namespace will make it easy for existing and new user= s > to quickly lookup the APIs. Along with that I have one recommendation, > first generate a trait for all the APIs and have the the instance in the > existing symbol. The usage would be something like below: > > trait SymbolAPIBase { > /** > api doc > */ > def Activation() > } > > object SymbolAPI extends SymbolAPIBase { > def Activation() > } > > object Symbol { > val api: SymbolBase =3D new SymbolAPI() > } > > Now users would use it as > Symbol.api.Activation() > > Creating a trait/Interface as several advantages: > 1) User do not have to know which concrete class to use, can be decided > later(Dependency Injection or Configuration driven application) > 2) Easier to change the implementation later without breaking the user co= de > -> You can insert different implementations through configuration using > frameworks such as Spring, etc., -> This is standard in most JVM driven > projects > 3) Easier to Unit test -> You can create Mocks easily using Mockito > 4) helps with multiple inheritance=E2=80=A6you cannot inherit multiple cl= asses > > Let me know what do you guys think. > > Thanks, Naveen > > On Sun, Apr 22, 2018 at 9:09 PM, YiZhi Liu wrote: > > > I personally like the design here. Since we have seen technical > > difficulties of compatibility, I would like to ask people pay > > attention to the 'How to combine with existing APIs' section: > > https://cwiki.apache.org/confluence/display/MXNET/ > > MXNet+Scala+API+Usability+Improvement#MXNetScalaAPIUsabilityImprovement= - > > HowtocombinewithexistingAPIs > > > > Qing proposed three options, > > > > 1. Add a new Class/Object called "NewSymbol/NDArray" with full > > implementation. > > 2. Create a new Class and change the name space for all of the > > functions (e.g Activation -> NewActivation) and let Symbol/NDArray > > extends that. > > 3. Create a new Class and override the Same functions with different > > implementations. > > > > If we have to choose from option 1 and 2, I would like to +0.5 for > > option 2, with which users can quickly aware of the new easy-to-use > > API: they type 'Symbol.' in IDE as usual and these functions pop up. > > > > 2018-04-19 10:58 GMT-07:00 Qing Lan : > > > Hi All, > > > > > > I am Qing, one of the Scala API maintainer for MXNet. I would like to > > propose a new design on Scala APIs, it will be really helpful for user = to > > use MXNet Symbol/NDArray. This is a follow-up from Naveen=E2=80=99s pro= posal. > > > > > > Background: > > > The current design on Scala would take arguments as key-value pair an= d > > didn=E2=80=99t provide the type information for different arguments. Th= ere are > > document missing for different functions which makes it even hard to us= e. > > > > > > Our approach: > > > We will provide a better designed Scala API for user to use with full > > documentation and arguments definition. All arguments will be > specifically > > targeted to different functions. Please see one example that we show in > the > > Wiki > MXNet+Scala+API+Usability+Improvement> and leave any thoughts you may > > have. This wiki includes examples, targets and scenarios we have so far= . > > > > > > Thanks, > > > Qing > > > > > > > > -- > > Yizhi Liu > > DMLC member > > Amazon Web Services > > Vancouver, Canada > > > --00000000000055b6ce056b2f4fed--