 // limitations under the License.
 
 import CTensorFlow
-import Foundation
 
 /// A TensorFlow checkpoint file reader.
 public class TensorFlowCheckpointReader {
-    @usableFromInline internal let status: OpaquePointer
-    @usableFromInline internal let handle: OpaquePointer
+    internal let status: OpaquePointer
+    internal let handle: OpaquePointer
 
-    /// URL of the checkpoint file.
-    public let checkpointPath: URL
+    /// The path to the checkpoint file.
+    public let checkpointPath: String
 
-    /// Number of tensors stored in the checkpoint.
+    /// The number of tensors stored in the checkpoint.
     public var tensorCount: Int { Int(TF_CheckpointReaderSize(handle)) }
 
-    /// Names of the tensors stored in the checkpoint.
+    /// The names of the tensors stored in the checkpoint.
     public var tensorNames: [String] {
         (0..<tensorCount).map {
             String(cString: TF_CheckpointReaderGetVariable(handle, Int32($0)))

        return TensorShape([Int64](dimensionsBufferPointer).map(Int.init))
    }

    /// Returns the data type of the tensor with the provided name stored in the checkpoint.
    @inlinable
    public func dataType(ofTensorNamed name: String) -> TensorDataType {
        TensorDataType(TF_CheckpointReaderGetVariableDataType(handle, name))
    }

    /// Loads and returns the value of the tensor with the provided name stored in the checkpoint.
    @inlinable
    public func load<Scalar: _TensorFlowDataTypeCompatible>(
        tensorNamed name: String
    ) -> ShapedArray<Scalar> {
        let pointer = TF_CheckpointReaderGetTensor(handle, name, status)
        checkOk(status)

    /// Creates a new TensorFlow checkpoint reader.
    ///
    /// - Arguments:
    ///   - checkpointPath: Path to the checkpoint file.
    public init(checkpointPath: String) {
        self.status = TF_NewStatus()
        self.handle = TF_NewCheckpointReader(checkpointPath, status)
        checkOk(status)
        self.checkpointPath = checkpointPath
    }

    deinit {
        TF_DeleteStatus(status)
        TF_DeleteCheckpointReader(handle)
    }

    /// Returns `true` if the checkpoint contains a tensor with the provided name.
    public func containsTensor(named name: String) -> Bool {
        TF_CheckpointReaderHasTensor(handle, name) > 0
    }

    /// Returns the shape of the tensor with the provided name stored in the checkpoint.
    public func shapeOfTensor(named name: String) -> TensorShape {
        let rank = TF_CheckpointReaderGetVariableNumDims(handle, name)
        let dimensions = UnsafeMutablePointer<Int64>.allocate(capacity: Int(rank))
        defer { dimensions.deallocate() }
