     }
 }
 
-func copy<T>(of handle: TensorHandle<T>) -> 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
+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 {

        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])

        let b = Tensor<Float>(0.1)
        let simple = Simple(w: w, b: b)

        let wHandle = w.handle.makeCopy()
        let bHandle = b.handle.makeCopy()

        let expectedSimple = Simple(_handles: [wHandle, bHandle])

