@Namespace(value="torch::nn") @NoOffset @Properties(inherit=torch.class) public class AdaptiveLogSoftmaxWithLossImpl extends AdaptiveLogSoftmaxWithLossImplCloneable
Efficient softmax approximation for GPUs_ by Edouard Grave, Armand Joulin,
Moustapha Cissé, David Grangier, and Hervé Jégou.
See
https://pytorch.org/docs/master/nn.html#torch.nn.AdaptiveLogSoftmaxWithLoss
to learn about the exact behavior of this module.
See the documentation for torch::nn::AdaptiveLogSoftmaxWithLossOptions
class to learn what constructor arguments are supported for this module.
Example:
AdaptiveLogSoftmaxWithLoss model(AdaptiveLogSoftmaxWithLossOptions(8, 10,
{4, 8}).div_value(2.).head_bias(true));
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter| Constructor and Description |
|---|
AdaptiveLogSoftmaxWithLossImpl(AdaptiveLogSoftmaxWithLossOptions options_) |
AdaptiveLogSoftmaxWithLossImpl(long in_features,
long n_classes,
LongVector cutoffs) |
AdaptiveLogSoftmaxWithLossImpl(Module pointer)
Downcast constructor.
|
AdaptiveLogSoftmaxWithLossImpl(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Tensor |
_get_full_log_prob(Tensor input,
Tensor head_output)
Given input tensor, and output of
head, computes the log of the full
distribution |
LongVector |
cutoffs()
Cutoffs used to assign targets to their buckets.
|
AdaptiveLogSoftmaxWithLossImpl |
cutoffs(LongVector setter) |
ASMoutput |
forward(Tensor input,
Tensor target) |
long |
head_size()
Output size of head classifier
|
AdaptiveLogSoftmaxWithLossImpl |
head_size(long setter) |
Tensor |
log_prob(Tensor input)
Computes log probabilities for all n_classes
|
long |
n_clusters()
Number of clusters
|
AdaptiveLogSoftmaxWithLossImpl |
n_clusters(long setter) |
AdaptiveLogSoftmaxWithLossOptions |
options()
The options with which this
Module was constructed |
AdaptiveLogSoftmaxWithLossImpl |
options(AdaptiveLogSoftmaxWithLossOptions setter) |
Tensor |
predict(Tensor input)
This is equivalent to
log_pob(input).argmax(1) but is more efficient in
some cases |
void |
pretty_print(Pointer stream)
Pretty prints the
AdaptiveLogSoftmaxWithLoss module into the given
stream. |
void |
reset_parameters() |
void |
reset()
reset() must perform initialization of all members with reference
semantics, most importantly parameters, buffers and submodules. |
long |
shortlist_size() |
AdaptiveLogSoftmaxWithLossImpl |
shortlist_size(long setter) |
asModule, asModule, clone, cloneapply, apply, apply, apply, apply, apply, apply, apply, buffers, buffers, children, eval, is_serializable, is_training, load, modules, modules, name, named_buffers, named_buffers, named_children, named_modules, named_modules, named_modules, named_parameters, named_parameters, parameters, parameters, register_buffer, register_buffer, register_module, register_module, register_parameter, register_parameter, register_parameter, register_parameter, save, shiftLeft, to, to, to, train, unregister_module, unregister_module, zero_gradaddress, 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, zeropublic AdaptiveLogSoftmaxWithLossImpl(Pointer p)
Pointer(Pointer).public AdaptiveLogSoftmaxWithLossImpl(Module pointer)
public AdaptiveLogSoftmaxWithLossImpl(@Cast(value="int64_t") long in_features, @Cast(value="int64_t") long n_classes, @ByVal @Cast(value="std::vector<int64_t>*") LongVector cutoffs)
public AdaptiveLogSoftmaxWithLossImpl(@ByVal AdaptiveLogSoftmaxWithLossOptions options_)
public void reset()
AdaptiveLogSoftmaxWithLossImplCloneablereset() must perform initialization of all members with reference
semantics, most importantly parameters, buffers and submodules.reset in class AdaptiveLogSoftmaxWithLossImplCloneablepublic void reset_parameters()
public void pretty_print(@Cast(value="std::ostream*") @ByRef Pointer stream)
AdaptiveLogSoftmaxWithLoss module into the given
stream.pretty_print in class Module@ByVal public Tensor _get_full_log_prob(@Const @ByRef Tensor input, @Const @ByRef Tensor head_output)
head, computes the log of the full
distribution@ByVal public Tensor log_prob(@Const @ByRef Tensor input)
@ByVal public Tensor predict(@Const @ByRef Tensor input)
log_pob(input).argmax(1) but is more efficient in
some cases@ByRef public AdaptiveLogSoftmaxWithLossOptions options()
Module was constructedpublic AdaptiveLogSoftmaxWithLossImpl options(AdaptiveLogSoftmaxWithLossOptions setter)
@ByRef @Cast(value="std::vector<int64_t>*") public LongVector cutoffs()
public AdaptiveLogSoftmaxWithLossImpl cutoffs(LongVector setter)
public AdaptiveLogSoftmaxWithLossImpl shortlist_size(long setter)
public AdaptiveLogSoftmaxWithLossImpl n_clusters(long setter)
public AdaptiveLogSoftmaxWithLossImpl head_size(long setter)
Copyright © 2024. All rights reserved.