Python objects & constants

Objects

tensor_qualifiers_dtype

NumPy dtype object that represents the cutensornetTensorQualifiers_t struct.

contraction_path_dtype

NumPy dtype object that represents the cutensornetContractionPath_t struct.

slice_info_pair_dtype

NumPy dtype object that represents the cutensornetSliceInfoPair_t struct.

slicing_config_dtype

NumPy dtype object that represents the cutensornetSlicingConfig_t struct.

Enums

Status(value)

See cutensornetStatus_t.

NetworkAttribute(value)

See cutensornetNetworkAttributes_t.

ContractionAutotunePreferenceAttribute(value)

See cutensornetContractionAutotunePreferenceAttributes_t.

ContractionOptimizerConfigAttribute(value)

See cutensornetContractionOptimizerConfigAttributes_t.

ContractionOptimizerInfoAttribute(value)

See cutensornetContractionOptimizerInfoAttributes_t.

GraphAlgo(value)

See cutensornetGraphAlgo_t.

MemoryModel(value)

See cutensornetMemoryModel_t.

OptimizerCost(value)

See cutensornetOptimizerCost_t.

SmartOption(value)

See cutensornetSmartOption_t.

WorksizePref(value)

See cutensornetWorksizePref_t.

Memspace(value)

See cutensornetMemspace_t.

WorkspaceKind(value)

See cutensornetWorkspaceKind_t.

TensorSVDConfigAttribute(value)

See cutensornetTensorSVDConfigAttributes_t.

TensorSVDInfoAttribute(value)

See cutensornetTensorSVDInfoAttributes_t.

TensorSVDNormalization(value)

See cutensornetTensorSVDNormalization_t.

TensorSVDPartition(value)

See cutensornetTensorSVDPartition_t.

TensorSVDAlgo(value)

See cutensornetTensorSVDAlgo_t.

GateSplitAlgo(value)

See cutensornetGateSplitAlgo_t.

StatePurity(value)

See cutensornetStatePurity_t.

BoundaryCondition(value)

See cutensornetBoundaryCondition_t.

StateAttribute(value)

See cutensornetStateAttributes_t.

StateMPOApplication(value)

See cutensornetStateMPOApplication_t.

MarginalAttribute(value)

See cutensornetMarginalAttributes_t.

SamplerAttribute(value)

See cutensornetSamplerAttributes_t.

AccessorAttribute(value)

See cutensornetAccessorAttributes_t.

ExpectationAttribute(value)

See cutensornetExpectationAttributes_t.

Python functions

Handle Management API

create()

Initializes the cuTensorNet library.

destroy(intptr_t handle)

Destroys the cuTensorNet library handle.

Network Descriptor API

create_network_descriptor(intptr_t handle, ...)

Initializes a cutensornetNetworkDescriptor_t, describing the connectivity (i.e., network topology) between the tensors.

destroy_network_descriptor(intptr_t desc)

Frees all the memory associated with the network descriptor.

get_output_tensor_descriptor(...)

Creates a cutensornetTensorDescriptor_t representing the output tensor of the network.

network_get_attribute(intptr_t handle, ...)

Gets attributes of network_descriptor.

network_set_attribute(intptr_t handle, ...)

Sets attributes of network_descriptor.

Tensor Descriptor API

create_tensor_descriptor(intptr_t handle, ...)

Initializes a cutensornetTensorDescriptor_t, describing the information of a tensor.

destroy_tensor_descriptor(intptr_t desc_tensor)

Frees all the memory associated with the tensor descriptor.

get_tensor_details(intptr_t handle, ...)

Get the tensor's metadata.

Contraction Optimizer API

create_contraction_optimizer_info(...)

Allocates resources for optimizerInfo.

create_contraction_optimizer_info_from_packed_data(...)

Create an optimizerInfo object from the provided buffer.

update_contraction_optimizer_info_from_packed_data(...)

Update the provided optimizer_info object from the provided buffer.

destroy_contraction_optimizer_info(...)

Frees all the memory associated with optimizer_info.

get_contraction_optimizer_info_attribute_dtype(...)

Get the Python data type of the corresponding ContractionOptimizerInfoAttribute attribute.

contraction_optimizer_info_get_attribute(...)

Gets attributes of optimizer_info.

contraction_optimizer_info_set_attribute(...)

Sets attributes of optimizer_info.

contraction_optimizer_info_get_packed_size(...)

Gets the packed size of the optimizer_info object.

contraction_optimizer_info_pack_data(...)

Packs the optimizer_info object into the provided buffer.

create_contraction_optimizer_config(...)

Sets up the required hyper-optimization parameters for the contraction order solver (see contraction_optimize()).

destroy_contraction_optimizer_config(...)

Frees all the memory associated with optimizer_config.

get_contraction_optimizer_config_attribute_dtype(...)

Get the Python data type of the corresponding ContractionOptimizerConfigAttribute attribute.

contraction_optimizer_config_get_attribute(...)

Gets attributes of optimizer_config.

contraction_optimizer_config_set_attribute(...)

Sets attributes of optimizer_config.

contraction_optimize(intptr_t handle, ...)

Computes an "optimized" contraction order as well as slicing info (for more information see Overview section) for a given tensor network such that the total time to solution is minimized while adhering to the user-provided memory constraint.

Contraction Plan API

create_contraction_plan(intptr_t handle, ...)

Initializes a cutensornetContractionPlan_t.

destroy_contraction_plan(intptr_t plan)

Frees all resources owned by plan.

create_contraction_autotune_preference(...)

Sets up the required auto-tune parameters for the contraction plan.

destroy_contraction_autotune_preference(...)

Frees all the memory associated with autotune_preference.

get_contraction_autotune_preference_attribute_dtype(...)

Get the Python data type of the corresponding ContractionAutotunePreferenceAttribute attribute.

contraction_autotune_preference_get_attribute(...)

Gets attributes of autotune_preference.

contraction_autotune_preference_set_attribute(...)

Sets attributes of autotune_preference.

contraction_autotune(intptr_t handle, ...)

Auto-tunes the contraction plan to find the best cutensorContractionPlan_t for each pair-wise contraction.

Workspace Management API

create_workspace_descriptor(intptr_t handle)

Creates a workspace descriptor that holds information about the user provided memory buffer.

destroy_workspace_descriptor(intptr_t desc)

Frees the workspace descriptor.

workspace_compute_contraction_sizes(...)

Computes the workspace size needed to contract the input tensor network using the provided contraction path.

workspace_compute_qr_sizes(intptr_t handle, ...)

Computes the workspace size needed to perform the tensor QR operation.

workspace_compute_svd_sizes(intptr_t handle, ...)

Computes the workspace size needed to perform the tensor SVD operation.

workspace_compute_gate_split_sizes(...)

Computes the workspace size needed to perform the gating operation.

workspace_get_memory_size(intptr_t handle, ...)

Retrieves the needed workspace size for the given workspace preference, memory space, workspace kind.

workspace_set_memory(intptr_t handle, ...)

Sets the memory address and workspace size of the workspace provided by user.

workspace_get_memory(intptr_t handle, ...)

Retrieves the memory address and workspace size of workspace hosted in the workspace descriptor.

workspace_purge_cache(intptr_t handle, ...)

Purges the cached data in the specified memory space.

Memory Management API

set_device_mem_handler(intptr_t handle, handler)

Set the device memory handler for cuTensorNet.

get_device_mem_handler(intptr_t handle)

Get the device memory handler for cuTensorNet.

Network Contraction API

contract_slices(intptr_t handle, ...)

Performs the actual contraction of the tensor network.

Gradient Computation API

compute_gradients_backward(intptr_t handle, ...)

Computes the gradients of the network w.r.t.

Slice Group API

create_slice_group_from_id_range(...)

Create a cutensornetSliceGroup_t object from a range, which produces a sequence of slice IDs from the specified start (inclusive) to the specified stop (exclusive) values with the specified step.

create_slice_group_from_ids(intptr_t handle, ...)

Create a slice group from a sequence of slice IDs.

destroy_slice_group(intptr_t slice_group)

Releases the resources associated with a cutensornetSliceGroup_t object and sets its value to null.

Approximate Tensor Network Execution API

tensor_qr(intptr_t handle, ...)

Performs QR decomposition of a tensor.

tensor_svd(intptr_t handle, ...)

Performs SVD decomposition of a tensor.

gate_split(intptr_t handle, ...)

Performs gate split operation.

Tensor SVD Config API

create_tensor_svd_config(intptr_t handle)

Sets up the options for singular value decomposition and truncation.

destroy_tensor_svd_config(intptr_t svd_config)

Frees all the memory associated with the tensor svd configuration.

get_tensor_svd_config_attribute_dtype(int attr)

Get the Python data type of the corresponding TensorSVDConfigAttribute attribute.

tensor_svd_config_get_attribute(...)

Gets attributes of svd_config.

tensor_svd_config_set_attribute(...)

Sets attributes of svd_config.

Tensor SVD Info API

create_tensor_svd_info(intptr_t handle)

Sets up the information for singular value decomposition.

destroy_tensor_svd_info(intptr_t svd_info)

Frees all the memory associated with the TensorSVDInfo object.

get_tensor_svd_info_attribute_dtype(int attr)

Get the Python data type of the corresponding TensorSVDInfoAttribute attribute.

tensor_svd_info_get_attribute(...)

Gets attributes of svd_info.

Distributed Parallelization API

distributed_reset_configuration(...)

Resets the distributed MPI parallelization configuration.

distributed_get_num_ranks(intptr_t handle)

Queries the number of MPI ranks in the current distributed MPI configuration.

distributed_get_proc_rank(intptr_t handle)

Queries the rank of the current MPI process in the current distributed MPI configuration.

distributed_synchronize(intptr_t handle)

Globally synchronizes all MPI processes in the current distributed MPI configuration, ensuring that all preceding cutensornet API calls have completed across all MPI processes.

get_mpi_comm_pointer(comm)

Simple helper to get the address to and size of a MPI_Comm handle.

High-Level Tensor Network API

create_state(intptr_t handle, int purity, ...)

Creates an empty tensor network state of a given shape defined by the number of primary tensor modes and their extents.

destroy_state(intptr_t tensor_network_state)

Frees all resources owned by the tensor network state.

state_apply_tensor(intptr_t handle, ...)

DEPRECATED: Applies a tensor operator to the tensor network state.

state_apply_tensor_operator(intptr_t handle, ...)

Applies a tensor operator to the tensor network state.

state_apply_controlled_tensor_operator(...)

Applies a controlled tensor operator to the tensor network state.

state_apply_network_operator(...)

Applies a tensor network operator to a tensor network state.

state_update_tensor(intptr_t handle, ...)

Registers an external update of the elements of the specified tensor operator that was previously applied to the tensor network state.

state_update_tensor_operator(...)

Registers an external update of the elements of the specified tensor operator that was previously applied to the tensor network state.

get_state_attribute_dtype(int attr)

Get the Python data type of the corresponding StateAttribute attribute.

state_configure(intptr_t handle, ...)

Configures computation of the full tensor network state, either in the exact or a factorized form.

state_prepare(intptr_t handle, ...)

Prepares computation of the full tensor network state, either in the exact or a factorized form.

state_get_info(intptr_t handle, ...)

Retrieves an attribute related to computation of the full tensor network state, either in the exact or a factorized form.

state_compute(intptr_t handle, ...)

Computes the tensor network state representation.

state_initialize_mps(intptr_t handle, ...)

Imposes a user-defined MPS (Matrix Product State) factorization on the initial tensor network state with the given shape and data.

state_finalize_mps(intptr_t handle, ...)

Imposes a user-defined MPS (Matrix Product State) factorization on the final tensor network state with the given shape.

create_marginal(intptr_t handle, ...)

Creates a representation of the specified marginal tensor for a given tensor network state.

destroy_marginal(...)

Destroys the tensor network state marginal.

get_marginal_attribute_dtype(int attr)

Get the Python data type of the corresponding MarginalAttribute attribute.

marginal_configure(intptr_t handle, ...)

Configures computation of the requested tensor network state marginal tensor.

marginal_prepare(intptr_t handle, ...)

Prepares computation of the requested tensor network state marginal tensor.

marginal_get_info(intptr_t handle, ...)

Retrieves an attribute related to computation of the requested tensor network state marginal tensor.

marginal_compute(intptr_t handle, ...)

Computes the requested tensor network state marginal tensor.

create_sampler(intptr_t handle, ...)

Creates a tensor network state sampler.

destroy_sampler(intptr_t tensor_network_sampler)

Destroys the tensor network state sampler.

get_sampler_attribute_dtype(int attr)

Get the Python data type of the corresponding SamplerAttribute attribute.

sampler_configure(intptr_t handle, ...)

Configures the tensor network state sampler.

sampler_prepare(intptr_t handle, ...)

Prepares the tensor network state sampler.

sampler_get_info(intptr_t handle, ...)

Retrieves an attribute related to tensor network state sampling.

sampler_sample(intptr_t handle, ...)

Performs sampling of the tensor network state, that is, generates the requested number of samples.

create_accessor(intptr_t handle, ...)

Creates a tensor network state amplitudes accessor.

destroy_accessor(...)

Destroyes the tensor network state amplitudes accessor.

get_accessor_attribute_dtype(int attr)

Get the Python data type of the corresponding AccessorAttribute attribute.

accessor_configure(intptr_t handle, ...)

Configures computation of the requested tensor network state amplitudes tensor.

accessor_prepare(intptr_t handle, ...)

Prepares computation of the requested tensor network state amplitudes tensor.

accessor_get_info(intptr_t handle, ...)

Retrieves an attribute related to computation of the requested tensor network state amplitudes tensor.

accessor_compute(intptr_t handle, ...)

Computes the amplitudes of the tensor network state.

create_expectation(intptr_t handle, ...)

Creates a representation of the tensor network state expectation value.

destroy_expectation(...)

Destroyes the tensor network state expectation value representation.

get_expectation_attribute_dtype(int attr)

Get the Python data type of the corresponding ExpectationAttribute attribute.

expectation_configure(intptr_t handle, ...)

Configures computation of the requested tensor network state expectation value.

expectation_prepare(intptr_t handle, ...)

Prepares computation of the requested tensor network state expectation value.

expectation_get_info(intptr_t handle, ...)

Retrieves an attribute related to computation of the requested tensor network state expectation value.

expectation_compute(intptr_t handle, ...)

Computes an (unnormalized) expectation value of a given tensor network operator over a given tensor network state.

Tensor Network Operator API

create_network_operator(intptr_t handle, ...)

Creates an uninitialized tensor network operator of a given shape defined by the number of state modes and their extents.

network_operator_append_product(...)

Appends a tensor product operator component to the tensor network operator.

network_operator_append_mpo(intptr_t handle, ...)

Appends a Matrix Product Operator (MPO) component to the tensor network operator.

destroy_network_operator(...)

Frees all resources owned by the tensor network operator.

Versioning API

get_version()

Returns Version number of the cuTensorNet library.

get_cudart_version()

Returns version number of the CUDA runtime that cuTensorNet was compiled against.