@NoOffset public static class memory.desc extends Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter| Constructor and Description |
|---|
desc()
Constructs a zero (empty) memory descriptor.
|
desc(dnnl_memory_desc_t data)
Constructs a memory descriptor from a C API data structure.
|
desc(long size)
Native array allocator.
|
desc(long[] dims,
memory.data_type data_type,
long[] strides) |
desc(long[] dims,
memory.data_type data_type,
long[] strides,
boolean allow_empty) |
desc(long[] dims,
memory.data_type data_type,
memory.format_tag format_tag) |
desc(long[] dims,
memory.data_type data_type,
memory.format_tag format_tag,
boolean allow_empty) |
desc(LongBuffer dims,
memory.data_type data_type,
LongBuffer strides) |
desc(LongBuffer dims,
memory.data_type data_type,
LongBuffer strides,
boolean allow_empty) |
desc(LongBuffer dims,
memory.data_type data_type,
memory.format_tag format_tag) |
desc(LongBuffer dims,
memory.data_type data_type,
memory.format_tag format_tag,
boolean allow_empty) |
desc(LongPointer dims,
memory.data_type data_type,
LongPointer strides) |
desc(LongPointer dims,
memory.data_type data_type,
LongPointer strides,
boolean allow_empty)
Constructs a memory descriptor by strides.
|
desc(LongPointer dims,
memory.data_type data_type,
memory.format_tag format_tag) |
desc(LongPointer dims,
memory.data_type data_type,
memory.format_tag format_tag,
boolean allow_empty)
Constructs a memory descriptor.
|
desc(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
memory.data_type |
data_type()
Returns the data type of the memory descriptor.
|
dnnl_memory_desc_t |
data()
The underlying C API data structure.
|
memory.desc |
data(dnnl_memory_desc_t setter) |
LongPointer |
dims()
Returns dimensions of the memory descriptor.
|
boolean |
equals(memory.desc other)
An equality operator.
|
long |
get_size()
Returns size of the memory descriptor in bytes.
|
boolean |
is_zero()
Checks whether the memory descriptor is zero (empty).
|
boolean |
notEquals(memory.desc other)
An inequality operator.
|
memory.desc |
permute_axes(int[] permutation) |
memory.desc |
permute_axes(int[] permutation,
boolean allow_empty) |
memory.desc |
permute_axes(IntBuffer permutation) |
memory.desc |
permute_axes(IntBuffer permutation,
boolean allow_empty) |
memory.desc |
permute_axes(IntPointer permutation) |
memory.desc |
permute_axes(IntPointer permutation,
boolean allow_empty)
Constructs a memory descriptor by permuting axes in an existing
one.
|
memory.desc |
position(long position) |
memory.desc |
reshape(long[] dims) |
memory.desc |
reshape(long[] dims,
boolean allow_empty) |
memory.desc |
reshape(LongBuffer dims) |
memory.desc |
reshape(LongBuffer dims,
boolean allow_empty) |
memory.desc |
reshape(LongPointer dims) |
memory.desc |
reshape(LongPointer dims,
boolean allow_empty)
Constructs a memory descriptor by reshaping an existing one.
|
memory.desc |
submemory_desc(long[] dims,
long[] offsets) |
memory.desc |
submemory_desc(long[] dims,
long[] offsets,
boolean allow_empty) |
memory.desc |
submemory_desc(LongBuffer dims,
LongBuffer offsets) |
memory.desc |
submemory_desc(LongBuffer dims,
LongBuffer offsets,
boolean allow_empty) |
memory.desc |
submemory_desc(LongPointer dims,
LongPointer offsets) |
memory.desc |
submemory_desc(LongPointer dims,
LongPointer offsets,
boolean allow_empty) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic desc(Pointer p)
Pointer.Pointer(Pointer).public desc(long size)
Pointer.position(long).public desc()
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer dims, memory.data_type data_type, memory.format_tag format_tag, @Cast(value="bool") boolean allow_empty)
abc...
format tag, and the physical meaning of the dimensions depends
both on the primitive that would operate on this memory and
the operation context.dims - Tensor dimensions.data_type - Data precision/type.format_tag - Memory format tag.allow_empty - A flag signifying whether construction is
allowed to fail without throwing an exception. In this case a
zero memory descriptor will be constructed. This flag is
optional and defaults to false.public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer dims, memory.data_type data_type, memory.format_tag format_tag)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer dims, memory.data_type data_type, memory.format_tag format_tag, @Cast(value="bool") boolean allow_empty)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer dims, memory.data_type data_type, memory.format_tag format_tag)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] dims, memory.data_type data_type, memory.format_tag format_tag, @Cast(value="bool") boolean allow_empty)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] dims, memory.data_type data_type, memory.format_tag format_tag)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer dims, memory.data_type data_type, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer strides, @Cast(value="bool") boolean allow_empty)
abc...
format tag, and the physical meaning of the dimensions depends
both on the primitive that would operate on this memory and
the operation context.dims - Tensor dimensions.data_type - Data precision/type.strides - Strides for each dimension.allow_empty - A flag signifying whether construction is
allowed to fail without throwing an exception. In this case a
zero memory descriptor will be constructed. This flag is
optional and defaults to false.public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer dims, memory.data_type data_type, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer strides)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer dims, memory.data_type data_type, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer strides, @Cast(value="bool") boolean allow_empty)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer dims, memory.data_type data_type, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer strides)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] dims, memory.data_type data_type, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] strides, @Cast(value="bool") boolean allow_empty)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] dims, memory.data_type data_type, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] strides)
public desc(@Const @ByRef dnnl_memory_desc_t data)
data - A C API ::dnnl_memory_desc_t structure.public memory.desc position(long position)
@ByRef public dnnl_memory_desc_t data()
public memory.desc data(dnnl_memory_desc_t setter)
@ByVal public memory.desc submemory_desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer dims, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer offsets, @Cast(value="bool") boolean allow_empty)
dims - Sizes of the region.
/** @param offsets Offsets to the region from the encompassing
/** memory object in each dimension.
/** @param allow_empty A flag signifying whether construction is
/** allowed to fail without throwing an exception. In this case a
/** zero memory descriptor will be returned. This flag is optional
/** and defaults to false.
/** @return A memory descriptor for the region.@ByVal public memory.desc submemory_desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer dims, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer offsets)
@ByVal public memory.desc submemory_desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer dims, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer offsets, @Cast(value="bool") boolean allow_empty)
@ByVal public memory.desc submemory_desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer dims, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer offsets)
@ByVal public memory.desc submemory_desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] dims, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] offsets, @Cast(value="bool") boolean allow_empty)
@ByVal public memory.desc submemory_desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] dims, @Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] offsets)
@ByVal public memory.desc reshape(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer dims, @Cast(value="bool") boolean allow_empty)
allow_empty flag.
The reshape operation can be described as a combination of the
following basic operations:
1. Add a dimension of size 1. This is always possible.
2. Remove a dimension of size 1. This is possible only if the
dimension has no padding (i.e.
padded_dims[dim] == dims[dim] && dims[dim] == 1).
3. Split a dimension into multiple ones. This is possible only if
the size of the dimension is exactly equal to the product of the
split ones and the dimension does not have padding (i.e.
padded_dims[dim] = dims[dim]).
4. Joining multiple consecutive dimensions into a single one. As in
the cases above, this requires that the dimensions do not have
padding and that the memory format is such that in physical
memory these dimensions are dense and have the same order as
their logical counterparts. This also assumes that these
dimensions are not blocked.
- Here, dense means:
stride for dim[i] == (stride for dim[i + 1]) * dim[i + 1];
- And same order means:
i < j if and only if stride for dim[j] <= stride for dim[i].
\warning
Some combinations of physical memory layout and/or offsets or
dimensions may result in a failure to make a reshape.dims - New dimensions. The product of dimensions must
remain constant.allow_empty - A flag signifying whether construction is
allowed to fail without throwing an exception. In this case a
zero memory descriptor will be returned. This flag is optional
and defaults to false.@ByVal public memory.desc reshape(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer dims)
@ByVal public memory.desc reshape(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer dims, @Cast(value="bool") boolean allow_empty)
@ByVal public memory.desc reshape(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer dims)
@ByVal public memory.desc reshape(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] dims, @Cast(value="bool") boolean allow_empty)
@ByVal public memory.desc reshape(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] dims)
@ByVal public memory.desc permute_axes(@StdVector IntPointer permutation, @Cast(value="bool") boolean allow_empty)
for (i = 0; i < ndims(); i++)
new_desc.dims()[permutation[i]] = dims()[i];
Example:
std::vector<int> permutation = {1, 0}; // swap the first and
// the second axes
dnnl::memory::desc in_md(
{2, 3}, data_type, memory::format_tag::ab);
dnnl::memory::desc expect_out_md(
{3, 2}, data_type, memory::format_tag::ba);
assert(in_md.permute_axes(permutation) == expect_out_md);
permutation - Axes permutation.allow_empty - A flag signifying whether construction is
allowed to fail without throwing an exception. In this case a
zero memory descriptor will be returned. This flag is optional
and defaults to false.@ByVal public memory.desc permute_axes(@StdVector IntPointer permutation)
@ByVal public memory.desc permute_axes(@StdVector IntBuffer permutation, @Cast(value="bool") boolean allow_empty)
@ByVal public memory.desc permute_axes(@StdVector IntBuffer permutation)
@ByVal public memory.desc permute_axes(@StdVector int[] permutation, @Cast(value="bool") boolean allow_empty)
@ByVal public memory.desc permute_axes(@StdVector int[] permutation)
@Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByVal public LongPointer dims()
public memory.data_type data_type()
@Cast(value="size_t") public long get_size()
@Cast(value="bool") public boolean is_zero()
@Cast(value="bool") @Name(value="operator ==") public boolean equals(@Const @ByRef memory.desc other)
other - Another memory descriptor.Copyright © 2020. All rights reserved.