How to use the bigdl.util.common.callBigDlFunc function in bigdl

To help you get started, we’ve selected a few bigdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github intel-analytics / BigDL / pyspark / bigdl / nn / layer.py View on Github external
def set_seed(self, seed=123):
        """
        You can control the random seed which used to init weights for this model.

        :param seed: random seed
        :return: Model itself.
        """
        callBigDlFunc(self.bigdl_type, "setModelSeed", seed)
        return self
github intel-analytics / analytics-zoo / models / src / main / python / bigdl / zoo / imageclassification.py View on Github external
def __init__(self, label_map, clses, probs, bigdl_type="float"):
        self.value = callBigDlFunc(
            bigdl_type, JavaValue.jvm_class_constructor(self), label_map, clses, probs)
github intel-analytics / analytics-zoo / pyzoo / zoo / pipeline / api / net.py View on Github external
def unfreeze(self, names=None):
        """
        "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

        :param names: list of module names to be unFreezed. Default is None.
        :return: current graph model
        """
        callBigDlFunc(self.bigdl_type, "unFreeze", self.value, names)
github intel-analytics / BigDL / pyspark / bigdl / transform / vision / image.py View on Github external
def get_image(self, float_key="floats", to_chw=True):
        """
        get image rdd from ImageFrame
        """
        tensor_rdd = callBigDlFunc(self.bigdl_type,
                               "distributedImageFrameToImageTensorRdd", self.value, float_key, to_chw)
        return tensor_rdd.map(lambda tensor: tensor.to_ndarray())
github intel-analytics / analytics-zoo / pyzoo / zoo / pipeline / api / keras / engine / topology.py View on Github external
non-trainable counts, will be printed out after the table.

        # Arguments
        line_length The total length of one row. Default is 120.
        positions: The maximum absolute length proportion(%) of each field.
                   List of Float of length 4.
                   Usually you don't need to adjust this parameter.
                   Default is [.33, .55, .67, 1.], meaning that
                   the first field will occupy up to 33% of line_length,
                   the second field will occupy up to (55-33)% of line_length,
                   the third field will occupy up to (67-55)% of line_length,
                   the fourth field will occupy the remaining line (100-67)%.
                   If the field has a larger length, the remaining part will be trimmed.
                   If the field has a smaller length, the remaining part will be white spaces.
        """
        callBigDlFunc(self.bigdl_type, "zooKerasNetSummary",
                      self.value,
                      line_length,
                      [float(p) for p in positions])
github intel-analytics / analytics-zoo / transform / vision / src / main / python / transform / vision / image.py View on Github external
def __init__(self, image=None, label=None, path=None, bigdl_type="float"):
        image_tensor = JTensor.from_ndarray(image) if image is not None else None
        label_tensor = JTensor.from_ndarray(label) if label is not None else None
        self.bigdl_type = bigdl_type
        self.value = callBigDlFunc(
            bigdl_type, JavaValue.jvm_class_constructor(self), image_tensor, label_tensor, path)
github intel-analytics / analytics-zoo / models / src / main / python / bigdl / zoo / imageclassification.py View on Github external
def read_imagenet_label_map():
    """
    load imagenet label map
    """
    return callBigDlFunc("float", "readImagenetLabelMap")
github intel-analytics / BigDL / pyspark / bigdl / transform / vision / image.py View on Github external
def get_uri(self, key = "uri"):
        return callBigDlFunc(self.bigdl_type, "distributedImageFrameToUri", self.value, key)
github intel-analytics / BigDL / pyspark / bigdl / optim / optimizer.py View on Github external
def set_train_summary(self, summary):
        """
        Set train summary. A TrainSummary object contains information
        necessary for the optimizer to know how often the logs are recorded,
        where to store the logs and how to retrieve them, etc. For details,
        refer to the docs of TrainSummary.


        :param summary: a TrainSummary object
        """
        callBigDlFunc(self.bigdl_type, "setTrainSummary", self.value,
                      summary)
        return self
github intel-analytics / BigDL / pyspark / bigdl / optim / optimizer.py View on Github external
def set_validation(self, batch_size, X_val, Y_val, trigger, val_method=None):
        """
        Configure validation settings.

        :param batch_size: validation batch size
        :param X_val: features of validation dataset
        :param Y_val: label of validation dataset
        :param trigger: validation interval
        :param val_method: the ValidationMethod to use,e.g. "Top1Accuracy", "Top5Accuracy", "Loss"
        """
        if val_method is None:
            val_method = [Top1Accuracy()]
        callBigDlFunc(self.bigdl_type, "setValidation", self.value, batch_size,
                      trigger, [JTensor.from_ndarray(X) for X in to_list(X_val)],
                      JTensor.from_ndarray(Y_val), to_list(val_method))