@Namespace(value="torch::optim") @NoOffset @Properties(inherit=torch.class) public class Optimizer extends Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
Optimizer(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add_param_group(OptimizerParamGroup param_group)
Adds the given param_group to the optimizer's param_group list.
|
void |
add_parameters(TensorVector parameters)
Adds the given vector of parameters to the optimizer's parameter list.
|
OptimizerOptions |
defaults() |
void |
load(InputArchive archive)
Deserializes the optimizer state from the given
archive . |
OptimizerParamGroupVector |
param_groups()
Provides a reference to the param_groups this optimizer holds.
|
TensorVector |
parameters()
Provides a reference to the parameters in the first param_group this
optimizer holds.
|
void |
save(OutputArchive archive)
Serializes the optimizer state into the given
archive . |
long |
size()
Returns the number of parameters referenced by the optimizer.
|
Tensor |
step() |
Tensor |
step(LossClosure closure)
A loss function closure, which is expected to return the loss value.
|
void |
zero_grad() |
void |
zero_grad(boolean set_to_none)
Zeros out the gradients of all parameters.
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public Optimizer(Pointer p)
Pointer(Pointer)
.public void add_param_group(@Const @ByRef OptimizerParamGroup param_group)
@ByVal public Tensor step(@ByVal(nullValue="torch::optim::Optimizer::LossClosure(nullptr)") LossClosure closure)
public void add_parameters(@Cast(value={"","std::vector<torch::Tensor>"}) @StdMove TensorVector parameters)
public void zero_grad(@Cast(value="bool") boolean set_to_none)
public void zero_grad()
@ByRef @NoException(value=true) public TensorVector parameters()
@Cast(value="size_t") @NoException(value=true) public long size()
@ByRef @NoException(value=true) public OptimizerOptions defaults()
@ByRef @NoException(value=true) public OptimizerParamGroupVector param_groups()
public void save(@ByRef OutputArchive archive)
archive
.public void load(@ByRef InputArchive archive)
archive
.Copyright © 2024. All rights reserved.