@Name(value="torch::OrderedDict<std::string,torch::Tensor>") @NoOffset @Properties(inherit=torch.class) public class StringTensorDict extends Pointer
OrderedDict
.Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
StringTensorDict() |
StringTensorDict(BytePointer key_description)
Constructs the
OrderedDict with a short description of the kinds of keys
stored in the OrderedDict . |
StringTensorDict(long size)
Native array allocator.
|
StringTensorDict(Pointer p)
Pointer cast constructor.
|
StringTensorDict(String key_description) |
StringTensorDict(StringTensorDict other)
Copy constructs this
OrderedDict from other . |
Modifier and Type | Method and Description |
---|---|
StringTensorDictItem |
back()
Returns the very last item in the
OrderedDict and throws an exception
if it is empty. |
StringTensorDictItemVector.Iterator |
begin()
Returns an iterator to the first item in the
OrderedDict . |
void |
clear()
Removes all items from this
OrderedDict . |
boolean |
contains(BytePointer key)
Returns true if the key is present in the
OrderedDict . |
boolean |
contains(String key) |
StringTensorDictItemVector.Iterator |
end()
Returns an iterator one past the last item in the
OrderedDict . |
void |
erase(BytePointer key)
Removes the item that has
key from this OrderedDict if exists and if
it doesn't an exception is thrown. |
void |
erase(String key) |
Tensor |
find(BytePointer key)
Returns a pointer to the value associated with the given key, or a
nullptr if no such key is stored in the OrderedDict . |
Tensor |
find(String key) |
StringTensorDictItem |
front()
Returns the very first item in the
OrderedDict and throws an exception
if it is empty. |
Tensor |
get(BytePointer key)
Returns the value associated with the given
key . |
StringTensorDictItem |
get(long index)
Returns the item at the
index -th position in the OrderedDict . |
Tensor |
get(String key) |
StringTensorDict |
getPointer(long i) |
Tensor |
insert(BytePointer key,
Tensor value)
Inserts a new
(key, value) pair into the OrderedDict . |
Tensor |
insert(String key,
Tensor value) |
boolean |
is_empty()
Returns true if the
OrderedDict contains no elements. |
StringTensorDictItemVector |
items()
Returns the items stored in the
OrderedDict . |
BytePointer |
key_description()
Returns the key description string the
OrderedDict was constructed with. |
StringVector |
keys()
Returns a newly allocated vector and copies all keys from this
OrderedDict into the vector. |
StringTensorVector |
pairs()
Returns a newly allocated vector and copies all keys and values from this
OrderedDict into a vector of std::pair<Key, Value> . |
StringTensorDict |
position(long position) |
StringTensorDict |
put(StringTensorDict other)
Assigns items from
other to this OrderedDict . |
void |
reserve(long requested_capacity)
Resizes internal storage to fit at least
requested_capacity items
without requiring reallocation. |
long |
size()
Returns the number of items currently stored in the
OrderedDict . |
void |
update(StringTensorDict other)
Inserts all items from
other into this OrderedDict . |
TensorVector |
values()
Returns a newly allocated vector and copies all values from this
OrderedDict into the vector. |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public StringTensorDict(Pointer p)
Pointer(Pointer)
.public StringTensorDict(long size)
Pointer.position(long)
.public StringTensorDict(@StdString BytePointer key_description)
OrderedDict
with a short description of the kinds of keys
stored in the OrderedDict
. This description is used in error messages
thrown by the OrderedDict
.public StringTensorDict()
public StringTensorDict(@StdString String key_description)
public StringTensorDict(@Const @ByRef StringTensorDict other)
OrderedDict
from other
.public StringTensorDict position(long position)
public StringTensorDict getPointer(long i)
getPointer
in class Pointer
@ByRef @Name(value="operator =") public StringTensorDict put(@Const @ByRef StringTensorDict other)
other
to this OrderedDict
.@StdString @NoException(value=true) public BytePointer key_description()
OrderedDict
was constructed with.@ByRef public StringTensorDictItem front()
OrderedDict
and throws an exception
if it is empty.@ByRef public StringTensorDictItem back()
OrderedDict
and throws an exception
if it is empty.@ByRef @Name(value="operator []") public StringTensorDictItem get(@Cast(value="size_t") long index)
index
-th position in the OrderedDict
. Throws
an exception if the index is out of bounds.@ByRef @Name(value="operator []") public Tensor get(@StdString BytePointer key)
key
. Throws an exception if
no such key is stored in the OrderedDict
. Use find()
for a
non-throwing way of accessing a value if it is present.@NoException(value=true) public Tensor find(@StdString BytePointer key)
nullptr
if no such key is stored in the OrderedDict
.@NoException(value=true) public Tensor find(@StdString String key)
@Cast(value="bool") @NoException(value=true) public boolean contains(@StdString BytePointer key)
OrderedDict
.@Cast(value="bool") @NoException(value=true) public boolean contains(@StdString String key)
@ByVal @Cast(value="torch::OrderedDict<std::string,torch::Tensor>::Iterator*") public StringTensorDictItemVector.Iterator begin()
OrderedDict
. Iteration is
ordered.@ByVal @Cast(value="torch::OrderedDict<std::string,torch::Tensor>::Iterator*") public StringTensorDictItemVector.Iterator end()
OrderedDict
.@Cast(value="size_t") @NoException(value=true) public long size()
OrderedDict
.@Cast(value="bool") @NoException(value=true) public boolean is_empty()
OrderedDict
contains no elements.public void reserve(@Cast(value="size_t") long requested_capacity)
requested_capacity
items
without requiring reallocation.@ByRef public Tensor insert(@StdString BytePointer key, @ByRef(value=true) Tensor value)
(key, value)
pair into the OrderedDict
. Throws an
exception if the key is already present. If insertion is successful,
immediately returns a reference to the inserted value.public void update(@ByRef(value=true) StringTensorDict other)
other
into this OrderedDict
. If any key from
other
is already present in this OrderedDict
, an exception is thrown.public void erase(@StdString BytePointer key)
key
from this OrderedDict
if exists and if
it doesn't an exception is thrown.public void erase(@StdString String key)
public void clear()
OrderedDict
.@Const @ByRef @NoException(value=true) public StringTensorDictItemVector items()
OrderedDict
.@ByVal public StringVector keys()
OrderedDict
into the vector.@ByVal public TensorVector values()
OrderedDict
into the vector.@ByVal public StringTensorVector pairs()
OrderedDict
into a vector of std::pair<Key, Value>
.Copyright © 2024. All rights reserved.