def __init__(self, storage, shape, bigdl_type="float", indices=None):
        """

        :param storage: values in this tensor
        :param shape: shape of this tensor
        :param bigdl_type: numeric type
        :param indices: if indices is provided, means this is a SparseTensor;
                        if not provided, means this is a DenseTensor
        """
        if isinstance(storage, bytes) and isinstance(shape, bytes):
            self.storage = np.frombuffer(storage, dtype=get_dtype(bigdl_type))
            self.shape = np.frombuffer(shape, dtype=np.int32)
        else:
            self.storage = np.array(storage, dtype=get_dtype(bigdl_type))
            self.shape = np.array(shape, dtype=np.int32)
        if indices is None:
            self.indices = None
        elif isinstance(indices, bytes):
            self.indices = np.frombuffer(indices, dtype=np.int32)
        else:
            assert isinstance(indices, np.ndarray), \
            "indices should be a np.ndarray, not %s, %s" % (type(a_ndarray), str(indices))
            self.indices = np.array(indices, dtype=np.int32)
        self.bigdl_type = bigdl_type
def __init__ ( self , storage , shape , bigdl_type = "float" , indices = None ) : if isinstance ( storage , bytes ) and isinstance ( shape , bytes ) : self . storage = np . frombuffer ( storage , dtype = get_dtype ( bigdl_type ) ) self . shape = np . frombuffer ( shape , dtype = np . int32 ) else : self . storage = np . array ( storage , dtype = get_dtype ( bigdl_type ) ) self . shape = np . array ( shape , dtype = np . int32 ) if indices is None : self . indices = None elif isinstance ( indices , bytes ) : self . indices = np . frombuffer ( indices , dtype = np . int32 ) else : assert isinstance ( indices , np . ndarray ) , "indices should be a np.ndarray, not %s, %s" % ( type ( a_ndarray ) , str ( indices ) ) self . indices = np . array ( indices , dtype = np . int32 ) self . bigdl_type = bigdl_type
:param storage: values in this tensor
        :param shape: shape of this tensor
        :param bigdl_type: numeric type
        :param indices: if indices is provided, means this is a SparseTensor;
                        if not provided, means this is a DenseTensor