(root_yaml,
                   be_type='gpu',
                   batch_size=128,
                   rng_seed=None,
                   device_id=0,
                   default_dtype=np.float32,
                   stochastic_rounding=False)
return model, cost, opt
Instantiate objects as per the given specifications.

    Arguments:
        root_yaml (dict): Model definition dictionary parse from YAML file

        be_type (str): backend either 'gpu', 'mgpu' or 'cpu'

        batch_size (int): Batch size.
        rng_seed (None or int): random number generator seed

        device_id (int): for GPU backends id of device to use

        default_dtype (type): numpy data format for default data types,

        stochastic_rounding (bool or int): number of bits for stochastic rounding
                                           use False for no rounding

    Returns:
        tuple: Contains model, cost and optimizer objects.
Instantiate objects as per the given specifications.
Instantiate objects as per the given specifications .
def create_objects(root_yaml,
                   be_type='gpu',
                   batch_size=128,
                   rng_seed=None,
                   device_id=0,
                   default_dtype=np.float32,
                   stochastic_rounding=False):
    """
    Instantiate objects as per the given specifications.

    Arguments:
        root_yaml (dict): Model definition dictionary parse from YAML file

        be_type (str): backend either 'gpu', 'mgpu' or 'cpu'

        batch_size (int): Batch size.
        rng_seed (None or int): random number generator seed

        device_id (int): for GPU backends id of device to use

        default_dtype (type): numpy data format for default data types,

        stochastic_rounding (bool or int): number of bits for stochastic rounding
                                           use False for no rounding

    Returns:
        tuple: Contains model, cost and optimizer objects.
    """

    assert NervanaObject.be is not None, 'Must generate a backend before running this function'

    # can give filename or parse dictionary
    if type(root_yaml) is str:
        with open(root_yaml, 'r') as fid:
            root_yaml = yaml.safe_load(fid.read())

    # in case references were used
    root_yaml = deepcopy(root_yaml)

    # initialize layers
    yaml_layers = root_yaml['layers']

    # currently only support sequential in yaml
    layer_dict = {'layers': yaml_layers}
    layers = Sequential.gen_class(layer_dict)

    # initialize model
    model = Model(layers=layers)

    # cost (before layers for shortcut derivs)
    cost_name = root_yaml['cost']
    cost = GeneralizedCost.gen_class({'costfunc': {'type': cost_name}})

    # create optimizer
    opt = None
    if 'optimizer' in root_yaml:
        yaml_opt = root_yaml['optimizer']
        typ = yaml_opt['type']
        opt = getattr(neon.optimizers, typ).gen_class(yaml_opt['config'])

    return model, cost, opt
def create_objects ( root_yaml , be_type = 'gpu' , batch_size = 128 , rng_seed = None , device_id = 0 , default_dtype = np . float32 , stochastic_rounding = False ) : assert NervanaObject . be is not None , 'Must generate a backend before running this function' # can give filename or parse dictionary if type ( root_yaml ) is str : with open ( root_yaml , 'r' ) as fid : root_yaml = yaml . safe_load ( fid . read ( ) ) # in case references were used root_yaml = deepcopy ( root_yaml ) # initialize layers yaml_layers = root_yaml [ 'layers' ] # currently only support sequential in yaml layer_dict = { 'layers' : yaml_layers } layers = Sequential . gen_class ( layer_dict ) # initialize model model = Model ( layers = layers ) # cost (before layers for shortcut derivs) cost_name = root_yaml [ 'cost' ] cost = GeneralizedCost . gen_class ( { 'costfunc' : { 'type' : cost_name } } ) # create optimizer opt = None if 'optimizer' in root_yaml : yaml_opt = root_yaml [ 'optimizer' ] typ = yaml_opt [ 'type' ] opt = getattr ( neon . optimizers , typ ) . gen_class ( yaml_opt [ 'config' ] ) return model , cost , opt