Class ParameterListImpl#
Defined in File parameterlist.h
Page Contents
Inheritance Relationships#
Base Type#
public torch::nn::Cloneable< ParameterListImpl >
(Template Class Cloneable)
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.
-
inline virtual void reset() override#
reset()
is empty forParameterList
, 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 givenstream
.
-
inline void append(torch::Tensor &¶m)#
push the a given parameter at the end of the list
-
inline void append(const torch::Tensor ¶m)#
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.
-
using Iterator = typename std::vector<OrderedDict<std::string, torch::Tensor>::Item>::iterator#