HeProfile#

class HeProfile#

A class to hold a complete HE profile of a given model run, including the requirements it takes from the HE context to be init with, the tile layout and some estimated measurements with respect to its run.

from_string(self: pyhelayers.HeProfile, content: str) None#

Loads the object from a string that contains content.

Parameters:

content – The content to load, must be in the same format that is returned by “to_string”.

get_context_name(self: pyhelayers.HeProfile) str#

Returns the name of the HE context to use for the HE model.

get_he_config_requirement(self: pyhelayers.HeProfile) pyhelayers.HeConfigRequirement#

Returns the HE config requirement to use for the HE model.

get_is_model_encrypted(self: pyhelayers.HeProfile) bool#

Returns indication to whether the model weights shall be encrypted.

get_optimal_batch_size(self: pyhelayers.HeProfile) int#

Returns the batch size (number of elements in a single batch) the model was optimized for, or -1 if batching is not applicable for the model.

If batch size is applicable, providing inputs with number of elements along the batch dimension that is different than the batch size is supported.

Providing number of elements smaller than the batch size will not improve the running time and memory consumption with respect to fully-populated batch of elements. For example, if the batch size is 8, providing 1-7 elements will “cost” the same as 8 elements.

Providing number of elements bigger than the batch size will lead to increasing the running time and memory consumption, and in such case providing number of elements enough to fully-populate the batches will lead to better utilization of resources. For example, if the batch size is 8, providing 16 elements will lead to higher running time with respect to 8 elements, and providing 9-15 elements will “cost” the same as 16 elements. Providing 17-23 elements will “cost” the same as 24 elements and will lead to even higher running time.

set_not_secure(self: pyhelayers.HeProfile) None#

Sets the profile to be in non-secure setting (security level 0).

set_not_secure_mockup(self: pyhelayers.HeProfile) None#

Sets the profile to be in non-secure setting (security level 0), and running with a mockup context

to_string(self: pyhelayers.HeProfile) str#

“Returns a string with the content of the object.