@Name(value="torch::OrderedDict<std::string,torch::nn::AnyModule>") @NoOffset @Properties(inherit=torch.class) public class StringAnyModuleDict extends Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
StringAnyModuleDict() |
StringAnyModuleDict(BytePointer key_description)
Constructs the
OrderedDict with a short description of the kinds of keys
stored in the OrderedDict . |
StringAnyModuleDict(long size)
Native array allocator.
|
StringAnyModuleDict(Pointer p)
Pointer cast constructor.
|
StringAnyModuleDict(String key_description) |
StringAnyModuleDict(StringAnyModuleDict other)
Copy constructs this
OrderedDict from other . |
Modifier and Type | Method and Description |
---|---|
StringAnyModuleDictItem |
back()
Returns the very last item in the
OrderedDict and throws an exception
if it is empty. |
StringAnyModuleDictItemVector.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) |
StringAnyModuleDictItemVector.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) |
AnyModule |
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 . |
AnyModule |
find(String key) |
StringAnyModuleDictItem |
front()
Returns the very first item in the
OrderedDict and throws an exception
if it is empty. |
AnyModule |
get(BytePointer key)
Returns the value associated with the given
key . |
StringAnyModuleDictItem |
get(long index)
Returns the item at the
index -th position in the OrderedDict . |
AnyModule |
get(String key) |
StringAnyModuleDict |
getPointer(long i) |
AnyModule |
insert(BytePointer key,
AnyModule value)
Inserts a new
(key, value) pair into the OrderedDict . |
AnyModule |
insert(String key,
AnyModule value) |
boolean |
is_empty()
Returns true if the
OrderedDict contains no elements. |
StringAnyModuleDictItemVector |
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. |
StringAnyModuleVector |
pairs()
Returns a newly allocated vector and copies all keys and values from this
OrderedDict into a vector of std::pair<Key, Value> . |
StringAnyModuleDict |
position(long position) |
StringAnyModuleDict |
put(StringAnyModuleDict 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(StringAnyModuleDict other)
Inserts all items from
other into this OrderedDict . |
AnyModuleVector |
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 StringAnyModuleDict(Pointer p)
Pointer(Pointer)
.public StringAnyModuleDict(long size)
Pointer.position(long)
.public StringAnyModuleDict(@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 StringAnyModuleDict()
public StringAnyModuleDict(@StdString String key_description)
public StringAnyModuleDict(@Const @ByRef StringAnyModuleDict other)
OrderedDict
from other
.public StringAnyModuleDict position(long position)
public StringAnyModuleDict getPointer(long i)
getPointer
in class Pointer
@ByRef @Name(value="operator =") public StringAnyModuleDict put(@Const @ByRef StringAnyModuleDict other)
other
to this OrderedDict
.@StdString @NoException(value=true) public BytePointer key_description()
OrderedDict
was constructed with.@ByRef public StringAnyModuleDictItem front()
OrderedDict
and throws an exception
if it is empty.@ByRef public StringAnyModuleDictItem back()
OrderedDict
and throws an exception
if it is empty.@ByRef @Name(value="operator []") public StringAnyModuleDictItem 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 AnyModule 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 AnyModule find(@StdString BytePointer key)
nullptr
if no such key is stored in the OrderedDict
.@NoException(value=true) public AnyModule 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::nn::AnyModule>::Iterator*") public StringAnyModuleDictItemVector.Iterator begin()
OrderedDict
. Iteration is
ordered.@ByVal @Cast(value="torch::OrderedDict<std::string,torch::nn::AnyModule>::Iterator*") public StringAnyModuleDictItemVector.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 AnyModule insert(@StdString BytePointer key, @ByRef(value=true) AnyModule 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) StringAnyModuleDict 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 StringAnyModuleDictItemVector items()
OrderedDict
.@ByVal public StringVector keys()
OrderedDict
into the vector.@ByVal public AnyModuleVector values()
OrderedDict
into the vector.@ByVal public StringAnyModuleVector pairs()
OrderedDict
into a vector of std::pair<Key, Value>
.Copyright © 2024. All rights reserved.