From dev-return-2758-archive-asf-public=cust-asf.ponee.io@singa.incubator.apache.org Fri Apr 12 08:07:15 2019 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 [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 92209180621 for ; Fri, 12 Apr 2019 10:07:15 +0200 (CEST) Received: (qmail 85255 invoked by uid 500); 12 Apr 2019 08:07:14 -0000 Mailing-List: contact dev-help@singa.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@singa.incubator.apache.org Delivered-To: mailing list dev@singa.incubator.apache.org Received: (qmail 85245 invoked by uid 99); 12 Apr 2019 08:07:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Apr 2019 08:07:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 48683CC802 for ; Fri, 12 Apr 2019 08:07:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -108.001 X-Spam-Level: X-Spam-Status: No, score=-108.001 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id b02tv0xsRXd8 for ; Fri, 12 Apr 2019 08:07:12 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 5431660D36 for ; Fri, 12 Apr 2019 08:07:02 +0000 (UTC) Received: (qmail 85017 invoked by uid 99); 12 Apr 2019 08:07:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Apr 2019 08:07:01 +0000 Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id D99BFE28B9 for ; Fri, 12 Apr 2019 08:07:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2569524422 for ; Fri, 12 Apr 2019 08:07:00 +0000 (UTC) Date: Fri, 12 Apr 2019 08:07:00 +0000 (UTC) From: "thao p nguyen (JIRA)" To: dev@singa.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (SINGA-444) Can not run Model classes examples on Singa documentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SINGA-444?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:all-tabpanel ] thao p nguyen resolved SINGA-444. --------------------------------- Resolution: Fixed > Can not run Model classes examples on Singa documentation > --------------------------------------------------------- > > Key: SINGA-444 > URL: https://issues.apache.org/jira/browse/SINGA-444 > Project: Singa > Issue Type: Bug > Components: Documentation > Environment: - python 3.6.8 > - Ubuntu 18.10 > Reporter: thao p nguyen > Priority: Critical > > Following the Singa documentation, the API code for running models' examp= le does not work. Below are messages: > 1) FeedForward Net > >>> from singa import tensor > >>> from singa import loss > >>> x =3D tensor.Tensor((3, 5)) > >>> x.uniform(0, 1)=C2=A0 # randomly genearte the prediction activation > >>> y =3D tensor.from_numpy(np.array([0, 1, 3], dtype=3Dnp.int))=C2=A0 # = set the truth > Traceback (most recent call last): > =C2=A0 File "", line 1, in > NameError: name 'np' is not defined > >>> f =3D loss.SoftmaxCrossEntropy() > >>> l =3D f.forward(True, x, y)=C2=A0 # l is tensor with 3 loss values > Traceback (most recent call last): > =C2=A0 File "", line 1, in > NameError: name 'y' is not defined > >>> g =3D f.backward()=C2=A0 # g is a tensor containing all gradients of = x w.r.t l > Segmentation fault (core dumped) > 2) Loss > >>> from singa import tensor > >>> from singa import loss > >>>=20 > >>> x =3D tensor.Tensor((3, 5)) > >>> x.uniform(0, 1)=C2=A0 # randomly genearte the prediction activation > >>> y =3D tensor.from_numpy(np.array([0, 1, 3], dtype=3Dnp.int))=C2=A0 # = set the truth > Traceback (most recent call last): > =C2=A0 File "", line 1, in > NameError: name 'np' is not defined > >>>=20 > >>> f =3D loss.SoftmaxCrossEntropy() > >>> l =3D f.forward(True, x, y)=C2=A0 # l is tensor with 3 loss values > Traceback (most recent call last): > =C2=A0 File "", line 1, in > NameError: name 'y' is not defined > >>> g =3D f.backward()=C2=A0 # g is a tensor containing all gradients of = x w.r.t l > 3) >>> from singa import tensor > >>> from singa import metric > >>>=20 > >>> x =3D tensor.Tensor((3, 5)) > >>> x.uniform(0, 1) # randomly genearte the prediction activation > >>> x =3D tensor.SoftMax(x) # normalize the prediction into probabilities > Traceback (most recent call last): > File "", line 1, in > AttributeError: module 'singa.tensor' has no attribute 'SoftMax' > >>> y =3D tensor.from_numpy(np.array([0, 1, 3], dtype=3Dnp.int)) # set th= e truth > Traceback (most recent call last): > File "", line 1, in > NameError: name 'np' is not defined > >>>=20 > >>> f =3D metric.Accuracy() > >>> acc =3D f.evaluate(x, y) # averaged accuracy over all 3 samples in x -- This message was sent by Atlassian JIRA (v7.6.3#76005)