Helper functions for PyTorch forecasting
Functions
apply_to_list(obj, func)
apply_to_list
Apply function to a list of objects or directly if passed value is not a list.
autocorrelation(input[, dim])
autocorrelation
Computes the autocorrelation of samples at dimension dim.
dim
create_mask(size, lengths[, inverse])
create_mask
Create boolean masks of shape len(lenghts) x size.
get_embedding_size(n[, max_size])
get_embedding_size
Determine empirically good embedding sizes (formula taken from fastai).
groupby_apply(keys, values[, bins, …])
groupby_apply
Groupby apply for torch tensors
integer_histogram(data[, min, max])
integer_histogram
Create histogram of integers in predefined range
next_fast_len(size)
next_fast_len
Returns the next largest number n >= size whose prime factors are all 2, 3, or 5.
n >= size
padded_stack(tensors[, side, mode, value])
padded_stack
Stack tensors along first dimension and pad them along last dimension to ensure their size is equal.
profile(function, profile_fname[, filter, …])
profile
Profile a given function with vmprof.
vmprof
to_list(value)
to_list
Convert value or list to list of values.
unpack_sequence(sequence)
unpack_sequence
Unpack RNN sequence.
unsqueeze_like(tensor, like)
unsqueeze_like
Unsqueeze last dimensions of tensor to match another tensor’s number of dimensions.