class_docstr: An NNP file loader.
  
  Args:
      filepath : file-like object or filepath.
      extension: if filepath is file-like object, extension is one of ".nnp", ".nntxt", ".prototxt".
  
  Example:
  
      .. code-block:: python
  
          from nnabla.utils.nnp_graph import NnpLoader
  
          # Read a .nnp file.
          nnp = NnpLoader('/path/to/nnp.nnp')
          # Assume a graph `graph_a` is in the nnp file.
          net = nnp.get_network(network_name, batch_size=1)
          # `x` is an input of the graph.
          x = net.inputs['x']
          # 'y' is an outputs of the graph.
          y = net.outputs['y']
          # Set random data as input and perform forward prop.
          x.d = np.random.randn(*x.shape)
          y.forward(clear_buffer=True)
          print('output:', y.d)
class_docstr_tok: ["An","NNP","file","loader",".","Args",":","filepath",":","file-like","object","or","filepath",".","extension",":","if","filepath","is","file-like","object",",","extension","is","one","of","``",".nnp","''",",","``",".nntxt","''",",","``",".prototxt","''",".","Example",":","..","code-block",":",":","python","from","nnabla.utils.nnp_graph","import","NnpLoader","#","Read","a",".nnp","file",".","nnp","=","NnpLoader","(","'\/path\/to\/nnp.nnp","'",")","#","Assume","a","graph","`","graph_a","`","is","in","the","nnp","file",".","net","=","nnp.get_network","(","network_name",",","batch_size=1",")","#","`","x","`","is","an","input","of","the","graph",".","x","=","net.inputs","[","'","x","'","]","#","'","y","'","is","an","outputs","of","the","graph",".","y","=","net.outputs","[","'","y","'","]","#","Set","random","data","as","input","and","perform","forward","prop",".","x.d","=","np.random.randn","(","*","x.shape",")","y.forward","(","clear_buffer=True",")","print","(","'output",":","'",",","y.d",")"]
code: def __init__(self, filepath, scope=None, extension=".nntxt"):
      # OrderedDict maintains loaded parameters from nnp files.
      # The loaded parameters will be copied to the current
      # scope when get_network is called.
      self._params = scope if scope else OrderedDict()
      self.g = nn.graph_def.load(
          filepath,
          parameter_scope=self._params,
          rng=np.random.RandomState(1223),
          extension=extension,
      )
      self.network_dict = {
          name: pn for name, pn in self.g.networks.items()
      }
  
imports: from __future__ import print_function
  import itertools
  from collections import OrderedDict
  import nnabla
  import numpy
label_desc: Use image node_id 1 to create a new NnpLoader object from inherited base classes: object with example: obj = NnpLoader(filepath, scope, extension)