• Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Special Offers
Business Intelligence Info
  • Business Intelligence
    • BI News and Info
    • Big Data
    • Mobile and Cloud
    • Self-Service BI
  • CRM
    • CRM News and Info
    • InfusionSoft
    • Microsoft Dynamics CRM
    • NetSuite
    • OnContact
    • Salesforce
    • Workbooks
  • Data Mining
    • Pentaho
    • Sisense
    • Tableau
    • TIBCO Spotfire
  • Data Warehousing
    • DWH News and Info
    • IBM DB2
    • Microsoft SQL Server
    • Oracle
    • Teradata
  • Predictive Analytics
    • FICO
    • KNIME
    • Mathematica
    • Matlab
    • Minitab
    • RapidMiner
    • Revolution
    • SAP
    • SAS/SPSS
  • Humor

Very simple example of NetChain running in MxNet cause error

September 5, 2017   BI News and Info

First define the net

SeedRandom[1234];
net = NetInitialize@NetChain[{5, 3}, "Input" -> 2];
{net[{1, 2}], net[{0, 0}], net[{0.1, 0.3}]}

{{1.27735, -1.21455, -1.02647}, {0., 0.,
0.}, {0.141054, -0.145882, -0.099945}}

Export it. (way from a great answer of How to export an MXNet?)

<< MXNetLink`;
<< NeuralNetworks`;
<< GeneralUtilities`;

jsonPath = "simple model-symbol.json";
paraPath = "simple model-0000.params";
Export[jsonPath, ToMXJSON[net][[1]], "String"]

f[str_] := 
 If[StringFreeQ[str, "Arrays"], str, StringReplace[
      StringSplit[str, ".Arrays."] /. {a_, b_} :> 
        StringJoin[{"arg:", a, "_", b}], {"Weights" -> "weight", "Biases" -> "bias"}]]

plan = ToMXPlan[net];
NDArrayExport[paraPath, NDArrayCreate /@ KeyMap[f, plan["ArgumentArrays"]]]

Python code to load the net

import mxnet as mx
sym, arg_params, aux_params = mx.model.load_checkpoint('simple model', 0)
mod = mx.mod.Module(symbol=sym)
(*At here,it throws error*)
mod.bind(for_training=False, data_shapes=[('data', (1,2))])
mod.set_params(arg_params, aux_params)

Then it throws error at mod = mx.mod.Module(symbol=sym)

ckA9l Very simple example of NetChain running in MxNet cause error

The JSON file(It define the net structure) is

d0p0U Very simple example of NetChain running in MxNet cause error

I really want to use net in my C++ project,a real problem.

Thank you!

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

cause, Error, example, MxNet, NetChain, Running, Simple, very
  • Recent Posts

    • New Customer Experience Needs and Commerce Trends for 2021
    • A data transformation problem in SQL and Scala: Dovetailing declarative solutions
    • George Wallace Joins Laverne Cox For Comedy Titled ‘Clean Slate’
    • How Microsoft Azure DevOps and Dynamics 365 CRM Work Together to Improve Service Responsiveness
    • The Benefits of Dynamics 365 Online Versus On-Premise
  • Categories

  • Archives

    • February 2021
    • January 2021
    • December 2020
    • November 2020
    • October 2020
    • September 2020
    • August 2020
    • July 2020
    • June 2020
    • May 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • September 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
© 2021 Business Intelligence Info
Power BI Training | G Com Solutions Limited