cuquantum.cutensornet.create_network_descriptor

cuquantum.cutensornet.create_network_descriptor(intptr_t handle, int32_t num_inputs, num_modes_in, extents_in, strides_in, modes_in, qualifiers_in, int32_t num_modes_out, extents_out, strides_out, modes_out, int data_type, int compute_type) intptr_t[source]

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

Parameters
  • handle (intptr_t) – Opaque handle holding cuTensorNet’s library context.

  • num_inputs (int32_t) – Number of input tensors.

  • num_modes_in (object) –

    Array of size num_inputs; num_modes_in[i] denotes the number of modes available in the i-th tensor. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int32_t.

  • extents_in (object) –

    Array of size num_inputs; extents_in[i] has num_modes_in[i] many entries with extents_in[i][j] (j < num_modes_in[i]) corresponding to the extent of the j-th mode of tensor i. It can be:

    • an int as the pointer address to the nested sequence, or

    • a Python sequence of ints, each of which is a pointer address to a valid sequence, or

    • a nested Python sequence of int64_t.

  • strides_in (object) –

    Array of size num_inputs; strides_in[i] has num_modes_in[i] many entries with strides_in[i][j] (j < num_modes_in[i]) corresponding to the linearized offset – in physical memory – between two logically-neighboring elements w.r.t the j-th mode of tensor i. It can be:

    • an int as the pointer address to the nested sequence, or

    • a Python sequence of ints, each of which is a pointer address to a valid sequence, or

    • a nested Python sequence of int64_t.

  • modes_in (object) –

    Array of size num_inputs; modes_in[i] has num_modes_in[i] many entries – each entry corresponds to a mode. Each mode that does not appear in the input tensor is implicitly contracted. It can be:

    • an int as the pointer address to the nested sequence, or

    • a Python sequence of ints, each of which is a pointer address to a valid sequence, or

    • a nested Python sequence of int32_t.

  • qualifiers_in (object) –

    Array of size num_inputs; qualifiers_in[i] denotes the qualifiers of i-th input tensor. Refer to cutensornetTensorQualifiers_t. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of cutensornetTensorQualifiers_t.

  • num_modes_out (int32_t) – number of modes of the output tensor. On entry, if this value is -1 and the output modes are not provided, the network will infer the output modes. If this value is 0, the network is force reduced.

  • extents_out (object) –

    Array of size num_modes_out; extents_out[j] (j < num_modes_out) corresponding to the extent of the j-th mode of the output tensor. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int64_t.

  • strides_out (object) –

    Array of size num_modes_out; strides_out[j] (j < num_modes_out) corresponding to the linearized offset – in physical memory – between two logically-neighboring elements w.r.t the j-th mode of the output tensor. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int64_t.

  • modes_out (object) –

    Array of size num_modes_out; modes_out[j] denotes the j-th mode of the output tensor. output tensor. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int32_t.

  • data_type (int) – Denotes the data type for all input an output tensors.

  • compute_type (ComputeType) – Denotes the compute type used throughout the computation.

Returns

Pointer to a cutensornetNetworkDescriptor_t.

Return type

intptr_t