This repository was archived by the owner on Jul 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-43
lines changed Expand file tree Collapse file tree 3 files changed +6
-43
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public protocol AnyTensor {
29
29
/// The generic parameter `Scalar` describes the type of scalars in the tensor (such as `Int32`,
30
30
/// `Float`, etc).
31
31
@frozen
32
- public struct Tensor < Scalar: TensorFlowScalar > : TensorProtocol {
32
+ public struct Tensor < Scalar: TensorFlowScalar > {
33
33
/// The underlying `TensorHandle`.
34
34
/// - Note: `handle` is public to allow user defined ops, but should not normally be used.
35
35
public let handle : TensorHandle < Scalar >
@@ -348,18 +348,8 @@ extension Tensor where Scalar: TensorFlowFloatingPoint {
348
348
/// during the conversion from an array literal to a `Tensor`, and is purely
349
349
/// for implementation purposes.
350
350
@frozen
351
- public struct _TensorElementLiteral < Scalar> : TensorProtocol where Scalar: TensorFlowScalar {
351
+ public struct _TensorElementLiteral < Scalar> where Scalar: TensorFlowScalar {
352
352
@usableFromInline let tensor : Tensor < Scalar >
353
-
354
- @inlinable
355
- public var handle : TensorHandle < Scalar > {
356
- return tensor. handle
357
- }
358
-
359
- @inlinable
360
- public init ( handle: TensorHandle < Scalar > ) {
361
- tensor = Tensor ( handle: handle)
362
- }
363
353
}
364
354
365
355
extension _TensorElementLiteral : ExpressibleByBooleanLiteral
Original file line number Diff line number Diff line change @@ -240,21 +240,20 @@ extension _TensorElementLiteral: TensorGroup {
240
240
return [ Scalar . tensorFlowDataType]
241
241
}
242
242
243
- public var _tensorHandles : [ _AnyTensorHandle ] { [ self . handle . handle ] }
243
+ public var _tensorHandles : [ _AnyTensorHandle ] { tensor . _tensorHandles }
244
244
245
245
public func _unpackTensorHandles( into address: UnsafeMutablePointer < CTensorHandle > ? ) {
246
- address! . initialize ( to : handle . _cTensorHandle )
246
+ tensor . _unpackTensorHandles ( into : address )
247
247
}
248
248
249
249
public init ( _owning tensorHandles: UnsafePointer < CTensorHandle > ? ) {
250
- self . init ( handle : TensorHandle ( _owning: tensorHandles! . pointee ) )
250
+ tensor = Tensor ( _owning: tensorHandles)
251
251
}
252
252
253
253
public init < C: RandomAccessCollection > (
254
254
_handles: C
255
255
) where C. Element: _AnyTensorHandle {
256
- precondition ( _handles. count == 1 )
257
- self . init ( handle: TensorHandle ( handle: _handles [ _handles. startIndex] ) )
256
+ tensor = Tensor ( _handles: _handles)
258
257
}
259
258
}
260
259
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments