zoo.pipeline.api.net package

Submodules

zoo.pipeline.api.net.graph_net module

class zoo.pipeline.api.net.graph_net.GraphNet(input, output, jvalue=None, bigdl_type='float', **kwargs)[source]

Bases: bigdl.nn.layer.Model

flattened_layers(include_container=False)[source]
freeze_up_to(names)[source]

Freeze the model from the bottom up to the layers specified by names (inclusive). This is useful for finetuning a model

Parameters:names – A list of module names to be Freezed
Returns:current graph model
static from_jvalue(jvalue, bigdl_type='float')[source]

Create a Python Model base on the given java value

Parameters:jvalue – Java object create by Py4j
Returns:A Python Model
layers
new_graph(outputs)[source]

Specify a list of nodes as output and return a new graph using the existing nodes

Parameters:outputs – A list of nodes specified
Returns:A graph model
predict(x, batch_per_thread=4, distributed=True)[source]

Use a model to do prediction.

# Arguments x: Prediction data. A Numpy array or RDD of Sample or ImageSet. batch_per_thread:

The default value is 4. When distributed is True,the total batch size is batch_per_thread * rdd.getNumPartitions. When distributed is False the total batch size is batch_per_thread * numOfCores.
distributed: Boolean. Whether to do prediction in distributed mode or local mode.
Default is True. In local mode, x must be a Numpy array.
to_keras()[source]
unfreeze(names=None)[source]

“unfreeze” module, i.e. make the module parameters(weight/bias, if exists) to be trained(updated) in training process. If ‘names’ is a non-empty list, unfreeze layers that match given names

Parameters:names – list of module names to be unFreezed. Default is None.
Returns:current graph model

zoo.pipeline.api.net.net_load module

class zoo.pipeline.api.net.net_load.JavaToPython(jvalue, bigdl_type='float')[source]

Bases: object

get_python_class()[source]

Redirect the jvalue to the proper python class. :param jvalue: Java object create by Py4j :return: A proper Python wrapper which would be a Model, Sequential…

class zoo.pipeline.api.net.net_load.Net[source]

Bases: object

static from_jvalue(jvalue, bigdl_type='float')[source]
static load(model_path, weight_path=None, bigdl_type='float')[source]

Load an existing Analytics Zoo model defined in Keras-style(with weights).

Parameters:
  • model_path – The path to load the saved model. Local file system, HDFS and Amazon S3 are supported. HDFS path should be like ‘hdfs://[host]:[port]/xxx’. Amazon S3 path should be like ‘s3a://bucket/xxx’.
  • weight_path – The path for pre-trained weights if any. Default is None.
Returns:

An Analytics Zoo model.

static load_bigdl(model_path, weight_path=None, bigdl_type='float')[source]

Load a pre-trained BigDL model.

Parameters:
  • model_path – The path to the pre-trained model.
  • weight_path – The path to the weights of the pre-trained model. Default is None.
Returns:

A pre-trained model.

static load_caffe(def_path, model_path, bigdl_type='float')[source]

Load a pre-trained Caffe model.

Parameters:
  • def_path – The path containing the caffe model definition.
  • model_path – The path containing the pre-trained caffe model.
Returns:

A pre-trained model.

static load_keras(json_path=None, hdf5_path=None, by_name=False)[source]

Load a pre-trained Keras model.

Parameters:
  • json_path – The json path containing the keras model definition. Default is None.
  • hdf5_path – The HDF5 path containing the pre-trained keras model weights with or without the model architecture. Default is None.
  • by_name – by default the architecture should be unchanged. If set as True, only layers with the same name will be loaded.
Returns:

A BigDL model.

static load_torch(path, bigdl_type='float')[source]

Load a pre-trained Torch model.

Parameters:path – The path containing the pre-trained model.
Returns:A pre-trained model.

zoo.pipeline.api.net.torch_criterion module

zoo.pipeline.api.net.torch_net module

zoo.pipeline.api.net.utils module

zoo.pipeline.api.net.utils.find_placeholders(grads)[source]
zoo.pipeline.api.net.utils.find_tensors(sources, predicate)[source]

find all the tensors that are used for computing grads and has been computed during forward :param grads: :param forward_ops: :return:

zoo.pipeline.api.net.utils.to_bigdl_optim_method(koptim_method)[source]

Module contents