mod_forward_gradient_batched¶
Universal routines for batchwise forward gradient passes. author: Alexander Knoll
Dependencies¶
Procedures Summary¶
| Name | Type | Description |
|---|---|---|
forward_gradient_batched_multiple_models |
Subroutine | Pass an array of features and their gradients forward through multiple models model in batches. ... |
forward_gradient_batched_single_model |
Subroutine | Pass an array of features and their gradients forward through multiple models model in batches. ... |
forward_gradient_and_store_with_extra_features |
Subroutine | |
forward_gradient_and_store |
Subroutine |
Interface Details¶
interface forward_gradient_batched¶
Procedure Details¶
subroutine forward_gradient_batched_multiple_models¶
subroutine forward_gradient_batched_multiple_models( &
models, &
model_indices, &
features, &
feature_derivatives, &
num_extra_features, &
extra_features, &
extra_feature_derivatives, &
xyz_indices, &
central_to_target_atom_map, &
num_features, &
batchsize, &
atomic_numbers, &
model_output &
)
Pass an array of features and their gradients forward through multiple models model in batches.
In this routine, we expect that each given sample provides
a contribution to the property of a target atom. Therefore,
xyz_indices does not have to be given for each sample, but only
for each target atom. The connection is made through
central_to_target_atom_map.
Arguments
-
models: type(ModelPtr) (dim: (:,:)) [inout]– The models through which the forward pass will be performed. -
model_indices: integer (dim: (:)) [in] -
features: real(DP) (dim: (:,:)) [inout]– The feature values for each sample (max_num_features x num_samples). -
feature_derivatives: real(DP) (dim: (:,:,:)) [in]– The derivatives of `features` along Cartesian axes (3 x max_num_features x num_samples). -
num_extra_features: integer (dim: (size(models,2))) [in] -
extra_features: real(DP) (dim: (:,:,:,:)) [in]– Dimensions: (maxval(num_extra_features), num_samples, committee_size, num_models). -
extra_feature_derivatives: real(DP) (dim: (:,:,:,:,:)) [in]– Dimensions: (3, maxval(num_extra_features), num_samples, committee_size, num_models). -
xyz_indices: integer (dim: (:)) [in]– The target xyz indices. This does not have length `num_samples` but length `num_target_atoms` instead. For each sample, only the gradient belong towards the target xyz component is passed forward. -
central_to_target_atom_map: integer (dim: (:)) [in]– Tells us which target atom a sample belongs to. -
num_features: integer (dim: (MAX_ELEM_NUM)) [in]– The number of features for each atomic number in `features. -
batchsize: integer (dim: (MAX_ELEM_NUM)) [in]– How large the batches are supposed to be for each atomic number. -
atomic_numbers: integer (dim: (:)) [in]– The atomic number belonging to each sample in `features` -
model_output: real(DP) (dim: (:,:,:,:)) [out]– The output of the model for each given sample. The values will be returned in the order in which the appeared in `features`. This is different from the order of the batched forward pass, which works through all batches of one atomic number before starting the next one. Dimensions: (num_samples, num_output_values, committee_size, num_models).
Called By
subroutine forward_gradient_batched_single_model¶
subroutine forward_gradient_batched_single_model( &
models, &
features, &
feature_derivatives, &
num_extra_features, &
extra_features, &
extra_feature_derivatives, &
xyz_indices, &
central_to_target_atom_map, &
num_features, &
batchsize, &
atomic_numbers, &
model_output &
)
Pass an array of features and their gradients forward through multiple models model in batches.
In this routine, we expect that each given sample provides
a contribution to the property of a target atom. Therefore,
xyz_indices does not have to be given for each sample, but only
for each target atom. The connection is made through
central_to_target_atom_map.
Arguments
-
models: type(ModelPtr) (dim: (:)) [inout]– The models through which the forward pass will be performed. -
features: real(DP) (dim: (:,:)) [inout]– The feature values for each sample (max_num_features x num_samples). -
feature_derivatives: real(DP) (dim: (:,:,:)) [in]– The derivatives of `features` along Cartesian axes (3 x max_num_features x num_samples). -
num_extra_features: integer [in] -
extra_features: real(DP) (dim: (:,:,:)) [in]– Dimensions: (maxval(num_extra_features), num_samples, committee_size). -
extra_feature_derivatives: real(DP) (dim: (:,:,:,:)) [in]– Dimensions: (3, maxval(num_extra_features), num_samples, committee_size). -
xyz_indices: integer (dim: (:)) [in]– The target xyz indices. This does not have length `num_samples` but length `num_target_atoms` instead. For each sample, only the gradient belong towards the target xyz component is passed forward. -
central_to_target_atom_map: integer (dim: (:)) [in]– Tells us which target atom a sample belongs to. -
num_features: integer (dim: (MAX_ELEM_NUM)) [in]– The number of features for each atomic number in `features. -
batchsize: integer (dim: (MAX_ELEM_NUM)) [in]– How large the batches are supposed to be for each atomic number. -
atomic_numbers: integer (dim: (:)) [in]– The atomic number belonging to each sample in `features` -
model_output: real(DP) (dim: (:,:,:)) [out]– The output of the model for each given sample. The values will be returned in the order in which the appeared in `features`. This is different from the order of the batched forward pass, which works through all batches of one atomic number before starting the next one. Dimensions: (num_samples, num_output_values, committee_size).
Called By
subroutine forward_gradient_and_store_with_extra_features¶
subroutine forward_gradient_and_store_with_extra_features( &
model, &
features, &
feature_derivatives, &
num_extra_features, &
extra_features, &
extra_feature_derivatives, &
ids, &
xyz_indices, &
central_to_target_atom_map, &
num_features, &
atomic_numbers, &
model_output &
)
Arguments
-
model: class(AbstractPropertyModel) [inout] -
features: real(DP) (dim: (:,:)) [inout] -
feature_derivatives: real(DP) (dim: (:,:,:)) [in] -
num_extra_features: integer [in] -
extra_features: real(DP) (dim: (:,:)) [in] -
extra_feature_derivatives: real(DP) (dim: (:,:,:)) [in] -
ids: integer (dim: (:)) [in] -
xyz_indices: integer (dim: (:)) [in] -
central_to_target_atom_map: integer (dim: (:)) [in] -
num_features: integer (dim: (MAX_ELEM_NUM)) [in] -
atomic_numbers: integer (dim: (:)) [in] -
model_output: real(DP) (dim: (:,:)) [out]
Called By
subroutine forward_gradient_and_store¶
subroutine forward_gradient_and_store( &
model, &
features, &
feature_derivatives, &
ids, &
xyz_indices, &
central_to_target_atom_map, &
num_features, &
atomic_numbers, &
model_output &
)
Arguments
-
model: class(AbstractPropertyModel) [inout] -
features: real(DP) (dim: (:,:)) [inout] -
feature_derivatives: real(DP) (dim: (:,:,:)) [in] -
ids: integer (dim: (:)) [in] -
xyz_indices: integer (dim: (:)) [in] -
central_to_target_atom_map: integer (dim: (:)) [in] -
num_features: integer (dim: (MAX_ELEM_NUM)) [in] -
atomic_numbers: integer (dim: (:)) [in] -
model_output: real(DP) (dim: (:,:)) [out]
Called By