Shortcuts

Class ParameterListImpl

Inheritance Relationships

Base Type

Class Documentation

class 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>
inline explicit ParameterListImpl(Tensors&&... params)

Constructs the ParameterList from a variadic list of ParameterList.

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

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

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

Pretty prints the ParameterList module into the given stream.

inline void append(torch::Tensor &&param)

push the a given parameter at the end of the list

inline void append(const torch::Tensor &param)

push the a given parameter at the end of the list

inline 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>
inline void extend(const Container &container)

extend parameters from a container to the end of the list

inline Iterator begin()

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

inline 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

inline Iterator end()

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

inline 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

inline 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

inline 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

inline 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

inline 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

inline size_t size() const noexcept

Return the size of the ParameterList.

inline bool is_empty() const noexcept

True if the ParameterList is empty.

template<typename Container>
inline 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