                 let genericMS = Generic<Mixed, Simple>(t: mixed, u: simple)
                 let generic = UltraNested(a: genericSM, b: genericMS)
 
-                let wHandle1 = copy(of: w.handle)
-                let wHandle2 = copy(of: w.handle)
-                let bHandle1 = copy(of: b.handle)
-                let bHandle2 = copy(of: b.handle)
-                let floatHandle1 = copy(of: float.handle)
-                let floatHandle2 = copy(of: float.handle)
-                let intHandle1 = copy(of: int.handle)
-                let intHandle2 = copy(of: int.handle)
+                let wHandle1 = w.handle.makeCopy()
+                let wHandle2 = w.handle.makeCopy()
+                let bHandle1 = b.handle.makeCopy()
+                let bHandle2 = b.handle.makeCopy()
+                let floatHandle1 = float.handle.makeCopy()
+                let floatHandle2 = float.handle.makeCopy()
+                let intHandle1 = int.handle.makeCopy()
+                let intHandle2 = int.handle.makeCopy()
 
                 let expectedGeneric = UltraNested<Simple, Mixed>(
                     _handles: [wHandle1, bHandle1, floatHandle1,  intHandle1,

        let mixed = Mixed(float: float, int: int)
        let generic = Generic(t: simple, u: mixed)

        let wHandle = copy(of: w.handle)
        let bHandle = copy(of: b.handle)
        let floatHandle = copy(of: float.handle)
        let intHandle = copy(of: int.handle)

        let expectedGeneric = Generic<Simple, Mixed>(
            _handles: [wHandle, bHandle, floatHandle, intHandle])

    }
}

extension TensorHandle {
    func makeCopy() -> TFETensorHandle {
        let status = TF_NewStatus()
        let result = TFETensorHandle(
          _owning: TFE_TensorHandleCopySharingTensor(handle._cTensorHandle, status)!)
        XCTAssertEqual(TF_GetCode(status), TF_OK)
        TF_DeleteStatus(status)
        return result
    }
}

final class TensorGroupTests: XCTestCase {
