@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[] adims,
memory.data_type adata_type,
long[] strides) |
desc(long[] adims,
memory.data_type adata_type,
long[] strides,
boolean allow_empty) |
desc(long[] adims,
memory.data_type adata_type,
memory.format_tag aformat_tag) |
desc(long[] adims,
memory.data_type adata_type,
memory.format_tag aformat_tag,
boolean allow_empty) |
desc(LongBuffer adims,
memory.data_type adata_type,
LongBuffer strides) |
desc(LongBuffer adims,
memory.data_type adata_type,
LongBuffer strides,
boolean allow_empty) |
desc(LongBuffer adims,
memory.data_type adata_type,
memory.format_tag aformat_tag) |
desc(LongBuffer adims,
memory.data_type adata_type,
memory.format_tag aformat_tag,
boolean allow_empty) |
desc(LongPointer adims,
memory.data_type adata_type,
LongPointer strides) |
desc(LongPointer adims,
memory.data_type adata_type,
LongPointer strides,
boolean allow_empty)
Constructs a memory descriptor by strides.
|
desc(LongPointer adims,
memory.data_type adata_type,
memory.format_tag aformat_tag) |
desc(LongPointer adims,
memory.data_type adata_type,
memory.format_tag aformat_tag,
boolean allow_empty)
Constructs a memory descriptor.
|
desc(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
asBoolean()
Checks whether the object is not empty.
|
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.
|
memory.desc |
getPointer(long i) |
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[] adims) |
memory.desc |
reshape(long[] adims,
boolean allow_empty) |
memory.desc |
reshape(LongBuffer adims) |
memory.desc |
reshape(LongBuffer adims,
boolean allow_empty) |
memory.desc |
reshape(LongPointer adims) |
memory.desc |
reshape(LongPointer adims,
boolean allow_empty)
Constructs a memory descriptor by reshaping an existing one.
|
memory.desc |
submemory_desc(long[] adims,
long[] offsets) |
memory.desc |
submemory_desc(long[] adims,
long[] offsets,
boolean allow_empty) |
memory.desc |
submemory_desc(LongBuffer adims,
LongBuffer offsets) |
memory.desc |
submemory_desc(LongBuffer adims,
LongBuffer offsets,
boolean allow_empty) |
memory.desc |
submemory_desc(LongPointer adims,
LongPointer offsets) |
memory.desc |
submemory_desc(LongPointer adims,
LongPointer offsets,
boolean allow_empty) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getPointer, getPointer, getPointer, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, 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 adims, memory.data_type adata_type, memory.format_tag aformat_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.adims - Tensor dimensions.adata_type - Data precision/type.aformat_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 adims, memory.data_type adata_type, memory.format_tag aformat_tag)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer adims, memory.data_type adata_type, memory.format_tag aformat_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 adims, memory.data_type adata_type, memory.format_tag aformat_tag)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] adims, memory.data_type adata_type, memory.format_tag aformat_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[] adims, memory.data_type adata_type, memory.format_tag aformat_tag)
public desc(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongPointer adims, memory.data_type adata_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.adims - Tensor dimensions.adata_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 adims, memory.data_type adata_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 adims, memory.data_type adata_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 adims, memory.data_type adata_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[] adims, memory.data_type adata_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[] adims, memory.data_type adata_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)
public memory.desc getPointer(long i)
getPointer in class Pointer@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 adims, @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)
adims - 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 adims, @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 adims, @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 adims, @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[] adims, @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[] adims, @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 adims, @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 product of all tensor diumensions stays constant and the
dimension being split does not have padding (i.e.
padded_dims[dim] = dims[dim]).
4. Join 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.adims - 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 adims)
@ByVal public memory.desc reshape(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef LongBuffer adims, @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 adims)
@ByVal public memory.desc reshape(@Const @Cast(value={"dnnl_dim_t*","std::vector<dnnl_dim_t>&"}) @StdVector(value="dnnl_dim_t") @ByRef long[] adims, @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[] adims)
@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.@Cast(value="bool") @Name(value="operator !=") public boolean notEquals(@Const @ByRef memory.desc other)
other - Another memory descriptor.Copyright © 2020. All rights reserved.