Shortcuts

Class ParameterListImpl

Inheritance Relationships

Base Type

Class Documentation

class torch::nn::ParameterListImpl : public torch::nn::Cloneable<ParameterListImpl>

Public Types

using Iterator = typename std::vector<OrderedDict<std::string, torch::Tensor>::Item>::iterator
using ConstIterator = typename std::vector<OrderedDict<std::string, torch::Tensor>::Item>::const_iterator

Public Functions

ParameterListImpl() = default
template<typename ...Tensors>
ParameterListImpl(Tensors&&... params)

Constructs the ParameterList from a variadic list of ParameterList.

template<typename ...Tensors>
ParameterListImpl(const Tensors&... params)
void reset() override

reset() is empty for ParameterList, since it does not have parameters of its own.

void pretty_print(std::ostream &stream) const override

Pretty prints the ParameterList module into the given stream.

void append(torch::Tensor &&param)

push the a given parameter at the end of the list

void append(const torch::Tensor &param)

push the a given parameter at the end of the list

void append(const OrderedDict<std::string, torch::Tensor>::Item &pair)

push the a given parameter at the end of the list And the key of the pair will be discarded, only the value will be added into the ParameterList

template<typename Container>
void extend(const Container &container)

extend parameters from a container to the end of the list

Iterator begin()

Returns an iterator to the start of the ParameterList the iterator returned will be type of OrderedDict<std::string, torch::Tensor>::Item

ConstIterator begin() const

Returns a const iterator to the start of the ParameterList the iterator returned will be type of OrderedDict<std::string, torch::Tensor>::Item

Iterator end()

Returns an iterator to the end of the ParameterList the iterator returned will be type of OrderedDict<std::string, torch::Tensor>::Item

ConstIterator end() const

Returns a const iterator to the end of the ParameterList the iterator returned will be type of OrderedDict<std::string, torch::Tensor>::Item

at::Tensor &at(size_t idx)

Returns the value associated with the given key.

Throws an exception if no such key is stored in the ParameterList. Check contains(key) before for a non-throwing way of access

const at::Tensor &at(size_t idx) const

Returns the value associated with the given key.

Throws an exception if no such key is stored in the ParameterList. Check contains(key) before for a non-throwing way of access

at::Tensor &operator[](size_t idx)

Returns the value associated with the given key.

Throws an exception if no such key is stored in the ParameterList. Check contains(key) before for a non-throwing way of access

const at::Tensor &operator[](size_t idx) const

Returns the value associated with the given key.

Throws an exception if no such key is stored in the ParameterList. Check contains(key) before for a non-throwing way of access

size_t size() const noexcept

Return the size of the ParameterList.

bool is_empty() const noexcept

True if the ParameterList is empty.

template<typename Container>
Container &operator+=(const Container &other)

Overload the +=, so that two ParameterList could be incrementally added.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources