|
LBANN
0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
|
Proxy a weights object as a different data type. More...
#include <weights_proxy.hpp>
Public Member Functions | |
Constructors | |
| WeightsProxy ()=default | |
| Construct an empty proxy. More... | |
| WeightsProxy (ViewingWeightsPtr const &w) | |
| Construct a proxy given the master object. More... | |
| WeightsProxy (WeightsProxy const &other) | |
| Copy a WeightsProxy object. More... | |
| template<typename T > | |
| WeightsProxy (WeightsProxy< T > const &other) | |
| Copy a WeightsProxy object. More... | |
| WeightsProxy (WeightsProxy &&other) noexcept | |
| Move a WeightsProxy object. More... | |
| ~WeightsProxy () noexcept | |
| Destructor. More... | |
Assignment operators | |
| WeightsProxy & | operator= (WeightsProxy const &other) |
| Copy assignment operator. More... | |
| template<typename T > | |
| WeightsProxy & | operator= (WeightsProxy< T > const &other) |
| Assignment from WeightsProxy object of a different type. More... | |
| WeightsProxy & | operator= (WeightsProxy &&other) noexcept |
| Move assignment from another proxy object. More... | |
Master object management and synchronization. | |
| void | clear () noexcept |
| Restore the default state of the proxy. More... | |
| void | setup (ViewingWeightsPtr const &w) |
| Provide setup function for delayed construction. More... | |
| void | synchronize_with_master () |
| Synchronize the held values with the master set. More... | |
Queries and accessors | |
| bool | empty () const noexcept |
| Check if the proxy is referencing a weights object. More... | |
| ValuesType const & | values () const noexcept(!LBANN_IN_DEBUG_MODE) |
| Access the values. More... | |
| weights const & | master_weights () const |
| Access the master weights object directly. More... | |
| ViewingWeightsPtr | master_weights_pointer () const noexcept(!LBANN_IN_DEBUG_MODE) |
Utility functions | |
| void | swap (WeightsProxy< TensorDataType > &other) |
| Swap contents with another WeightsProxy object. More... | |
Private Types | |
| using | ValuesType = El::AbstractDistMatrix< TensorDataType > |
| The type of weights values. More... | |
| using | ValuesPtrType = std::unique_ptr< ValuesType > |
| Convenience typedef for poitners to weights values. More... | |
Private Member Functions | |
Private setup functions | |
| ValuesPtrType | setup_values_ (data_type_weights< TensorDataType > const &dtw) const |
| Establish the view of the master data. More... | |
| template<typename OtherT > | |
| ValuesPtrType | setup_values_ (data_type_weights< OtherT > const &w) const |
| Establish the target matrix storage. More... | |
| ValuesPtrType | setup_values_ (weights const &w) const |
| Establish the target matrix storage. More... | |
| ValuesPtrType | setup_values_as_copy_ (weights const &w) const |
| Create the matrix object to store the copied weights. More... | |
Private Attributes | |
Private members | |
| ViewingWeightsPtr | master_weights_ |
| The proxied master weights. More... | |
| ValuesPtrType | values_ |
| The values in this data type. More... | |
Proxy a weights object as a different data type.
This class is intended to be an implementation detail of the layers' interactions with weights objects. Thus, the implementation employs a programming-by-contract approach in an effort to avoid, e.g., safe dereferences to internal pointer members.
The class contract is as follows:
true.| TensorDataType | The type to which the weights are proxied. |
Definition at line 77 of file weights_proxy.hpp.
|
private |
Convenience typedef for poitners to weights values.
Definition at line 82 of file weights_proxy.hpp.
|
private |
The type of weights values.
Definition at line 80 of file weights_proxy.hpp.
|
default |
Construct an empty proxy.
|
inline |
Construct a proxy given the master object.
| w | Master weights object, which must have a valid storage matrix initialized internally. |
Definition at line 96 of file weights_proxy.hpp.
|
inline |
Copy a WeightsProxy object.
Creates a new proxy to the same weights object.
Definition at line 107 of file weights_proxy.hpp.
|
inline |
Copy a WeightsProxy object.
Creates a new proxy to the same weights object.
| T | (Deduced) The type of the input weights object's values. |
Definition at line 122 of file weights_proxy.hpp.
|
inlinenoexcept |
Move a WeightsProxy object.
Unlike copy construction, move construction is only supported for WeightsProxy objects of the same static type.
Definition at line 135 of file weights_proxy.hpp.
|
inlinenoexcept |
Destructor.
Definition at line 143 of file weights_proxy.hpp.
|
inlinenoexcept |
Restore the default state of the proxy.
After this function is called, the object will be empty().
Definition at line 188 of file weights_proxy.hpp.
|
inlinenoexcept |
Check if the proxy is referencing a weights object.
Definition at line 236 of file weights_proxy.hpp.
|
inline |
Access the master weights object directly.
The contract of this class specifies that this function is only valid if not empty(). Users are expected to ensure this contract.
Definition at line 256 of file weights_proxy.hpp.
|
inlinenoexcept |
|
inline |
Copy assignment operator.
Definition at line 151 of file weights_proxy.hpp.
|
inline |
Assignment from WeightsProxy object of a different type.
After assignment, this and other both proxy the weights proxied by other.
| T | (Deduced) The type of the input weights object's values. |
Definition at line 166 of file weights_proxy.hpp.
|
inlinenoexcept |
Move assignment from another proxy object.
Definition at line 173 of file weights_proxy.hpp.
|
inline |
Provide setup function for delayed construction.
This overwrites any existing data.
| w | The weights object to be proxied. |
Definition at line 200 of file weights_proxy.hpp.
|
inlineprivate |
Establish the view of the master data.
Definition at line 288 of file weights_proxy.hpp.
|
inlineprivate |
Establish the target matrix storage.
This only participates in overload resolution if OtherT is different from TensorDataType, which has a dedicated overload.
| OtherT | (Deduced) The type of the input weights object's values. |
Definition at line 306 of file weights_proxy.hpp.
|
inlineprivate |
Establish the target matrix storage.
Definition at line 312 of file weights_proxy.hpp.
|
inlineprivate |
Create the matrix object to store the copied weights.
Definition at line 320 of file weights_proxy.hpp.
|
inline |
Swap contents with another WeightsProxy object.
Definition at line 274 of file weights_proxy.hpp.
|
inline |
Synchronize the held values with the master set.
If empty(), this function takes the view that there is no master with which to synchronize, so no action is required – it is a no-op.
Definition at line 217 of file weights_proxy.hpp.
|
inlinenoexcept |
Access the values.
The contract of this class specifies that this function is only valid if not empty(). Users are expected to ensure this contract.
Definition at line 244 of file weights_proxy.hpp.
|
private |
The proxied master weights.
Definition at line 336 of file weights_proxy.hpp.
|
private |
The values in this data type.
Definition at line 339 of file weights_proxy.hpp.