     }
 }
 
+public extension Tensor where R.Shape == Shape2D {
+    fileprivate func getElementShape() -> Shape1D {
+        return arrayToShape(Array(dynamicShape.dimensions.dropFirst()))
+    }
+}
+
 /// - TODO: Add conditional expressibility conformance in Swift 4
 
 public extension Tensor where R.DataType : Equatable {

    }
}


extension Tensor : RandomAccessCollection {
    public typealias Index = Int
    public typealias Element = ElementTensor

            case is DataType.Type:
                return units[index] as! Element
            case is Tensor1D<DataType>.Type:
                let elementShape: Shape1D = arrayToShape(Array(dynamicShape.dimensions.dropFirst()))
                let elementUnits = getElementTensorUnits(index: index)
                return Tensor1D<DataType>(shape: elementShape, units: elementUnits) as! Element
            case is Tensor2D<DataType>.Type:
                let elementShape: Shape2D = arrayToShape(Array(dynamicShape.dimensions.dropFirst()))
                let elementUnits = getElementTensorUnits(index: index)
                return Tensor2D<DataType>(shape: elementShape, units: elementUnits) as! Element
            case is Tensor3D<DataType>.Type:
                let elementShape: Shape3D = arrayToShape(Array(dynamicShape.dimensions.dropFirst()))
                let elementUnits = getElementTensorUnits(index: index)
                return Tensor3D<DataType>(shape: elementShape, units: elementUnits) as! Element
            default:
                fatalError("Invalid element tensor type")
            }
