@Namespace(value="torch::autograd") @NoOffset @Properties(inherit=torch.class) public class AutogradContext extends Pointer
forward
that can be accessed in
backward
in custom autograd operations (see torch::autograd::Function
for details).Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
AutogradContext() |
AutogradContext(long size)
Native array allocator.
|
AutogradContext(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
TensorImplSet |
get_and_bump_dirty() |
TensorImplSet |
get_non_differentiable() |
TensorVector |
get_saved_variables()
Get the list of variables that were saved in
forward using
save_for_backward() . |
AutogradContext |
getPointer(long i) |
void |
mark_dirty(TensorVector inputs)
Marks variables in the list as modified in an in-place operation.
|
void |
mark_non_differentiable(TensorVector outputs)
Marks outputs in the list as not requiring gradients.
|
boolean |
needs_input_grad(long output_edge_index)
Expose the Node's
task_should_compute_output method to the cpp
custom autograd Function as needs_input_grad . |
AutogradContext |
position(long position) |
void |
save_for_backward(TensorVector to_save)
Saves the list of variables for a future call to
backward . |
void |
set_materialize_grads(boolean value) |
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 AutogradContext(Pointer p)
Pointer(Pointer)
.public AutogradContext(long size)
Pointer.position(long)
.public AutogradContext()
public AutogradContext position(long position)
public AutogradContext getPointer(long i)
getPointer
in class Pointer
public void save_for_backward(@ByVal TensorVector to_save)
backward
. This
should be called at most once from inside of forward
.public void mark_dirty(@Const @ByRef TensorVector inputs)
forward
and all arguments
should be inputs.public void mark_non_differentiable(@Const @ByRef TensorVector outputs)
forward
and all arguments should be
outputs.@ByVal public TensorVector get_saved_variables()
forward
using
save_for_backward()
. Before returning them to the user, a check is made
to ensure that they were not modified by any in-place operations.@Const @ByRef public TensorImplSet get_and_bump_dirty()
@Const @ByRef public TensorImplSet get_non_differentiable()
Copyright © 2024. All rights reserved.