def from_array(
        array: _np.array,
        file: _BinaryIO,
    ) -> _Type["_TensorDescriptor"]:
        """
        Create a TensorDescriptor from a numpy array and write the data to a binary file.

        This static method converts a numpy array into a TensorDescriptor and writes the
        array data to the provided binary file.

        Parameters
        ----------
        array: np.array
            The numpy array to convert.

        file: BinaryIO
            A binary file object to which the array data will be written.

        Returns
        -------
        TensorDescriptor
             A new TensorDescriptor instance representing the input array.
        """
        shape = list(array.shape)
        strides = [x // array.dtype.itemsize for x in list(array.strides)]
        data_type = _TensorDescriptor._to_multi_array_dtype(array.dtype)

        offset = file.tell()
        buffer = array.tobytes()
        size = len(buffer)
        file.write(buffer)

        storage = _TensorStorage(
            offset=offset,
            size=size,
        )

        return _TensorDescriptor(
            shape=shape,
            strides=strides,
            data_type=data_type,
            storage=storage,
        )

        Create a TensorDescriptor from a numpy array and write the data to a binary file.

        This static method converts a numpy array into a TensorDescriptor and writes the
        array data to the provided binary file.

        Parameters
        ----------
        array: np.array
            The numpy array to convert.

        file: BinaryIO
            A binary file object to which the array data will be written.

        Returns
        -------
        TensorDescriptor
             A new TensorDescriptor instance representing the input array.
        
coremltools/models/ml_program/experimental/remote_device.py