neon.backends.nervanamkl.MKLTensor

class neon.backends.nervanamkl.MKLTensor(backend, shape=None, dtype=<class 'numpy.float32'>, ary=None, name=None, persist_values=True, base=None)[source]

Bases: neon.backends.nervanacpu.CPUTensor

MKLTensor, special for MKL Backend

__init__(backend, shape=None, dtype=<class 'numpy.float32'>, ary=None, name=None, persist_values=True, base=None)[source]

Methods

__init__(backend[, shape, dtype, ary, name, …])
asnumpyarray() Deprecated.
clean_mkl()
copy(a) Construct and return a deep copy of the Tensor passed.
copy_from(a) Alias of copy.
dimension_reorder(new_order) Re-orders dimensions of a tensor without preserving data
fill(value) Assign specified value to each element of this CPUTensor.
get() Return the array.
get_prim()
hist(tag) Compute a histogram of the current tensor values.
raw() Access the raw buffer.
reshape(*shape) Return a reshaped view.
set(value) Wrap the value into NervanaCPU tensor.
set_mkl(tensor)
share(shape[, dtype, name]) Return a view: ary, where ary.size <= self.size.
take(indices[, axis]) Select a subset of elements from an array across an axis.
transpose([out]) Return a transposed view of the data.
T

Return a transposed view.

For 2D tensor, will do a normal transpose For 3D tensor, will keep the 0 dim, swap the 1 and 2 dimensions

asnumpyarray()

Deprecated. Scheduled to be removed in 2.0. Use get() instead.

clean_mkl()[source]
copy(a)

Construct and return a deep copy of the Tensor passed.

Arguments:
a (Tensor): the object to copy
Returns:new array object with the same values as input tensor
Return type:Tensor
copy_from(a)

Alias of copy.

Parameters:a (Tensor) – the object to copy
Returns:new array object with the same values as input tensor
Return type:Tensor
dimension_reorder(new_order)

Re-orders dimensions of a tensor without preserving data

Parameters:new_order (list) – new order of dimensions
fill(value)

Assign specified value to each element of this CPUTensor.

Parameters:value (numeric) – The value to be assigned to each element.
Returns:updated view of the data.
Return type:CPUTensor
get()[source]

Return the array.

get_prim()[source]
hist(tag)

Compute a histogram of the current tensor values.

Parameters:tag (string) – Tag to identify the current state of the tensor, useful for disambiguating multiple histograms of the same tensor at different points in time.
Returns:Tensor containing the histogram data.
raw()

Access the raw buffer.

Returns:A device specific pointer
Return type:pointer
reshape(*shape)[source]

Return a reshaped view.

set(value)

Wrap the value into NervanaCPU tensor.

Parameters:value – Array or single input. If it is array, check and Convert the dtype and shape. If it is single value, broadcast to the memory
Returns:self
set_mkl(tensor)[source]
share(shape, dtype=None, name=None)

Return a view: ary, where ary.size <= self.size. Allows easy sharing of temporary memory This is mostly provided for compatibility, – dtype is ignored

take(indices, axis=None)

Select a subset of elements from an array across an axis.

Parameters:
  • indices (Tensor, numpy ndarray) – indicies of elements to select
  • axis (int) – axis across which to select the values
Returns:

Tensor with selected values

Return type:

Tensor

transpose(out=None)

Return a transposed view of the data. Alias of .T property