-
Notifications
You must be signed in to change notification settings - Fork 137
Conversation
} | ||
} | ||
|
||
public class LazyTensorOperation : TensorOperation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this type needs to be a public API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no. Removed public
from class and all APIs.
public func evaluate() -> [LazyTensor] { | ||
return Array((0..<outputCount).map { | ||
LazyTensor(_lazyLive: self, index: $0) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}) | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, @rxwei. I have addressed all your comments. PTAL.
public func evaluate() -> [LazyTensor] { | ||
return Array((0..<outputCount).map { | ||
LazyTensor(_lazyLive: self, index: $0) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
} | ||
|
||
public class LazyTensorOperation : TensorOperation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no. Removed public
from class and all APIs.
@rxwei and @dan-zheng, are you OK with this PR? |
typealias CTFTensor = OpaquePointer | ||
|
||
@usableFromInline | ||
class LazyTensor : _AnyTensorHandle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class LazyTensor : _AnyTensorHandle { | |
class LazyTensor: _AnyTensorHandle { |
import CTensorFlow | ||
|
||
/// The `TF_Tensor *` type. | ||
typealias CTFTensor = OpaquePointer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be fileprivate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is an artifact of some earlier version. I removed this altogether.
case Input.single(let lazyTensor): | ||
return "\(lazyTensor)" | ||
case Input.list(let lazyTensorList): do { | ||
let lazyTensors = lazyTensorList.map{ "\($0)" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation here seems incorrect. Also there should be a space before a trailing closure.
let lazyTensors = lazyTensorList.map{ "\($0)" } | |
let lazyTensors = lazyTensorList.map { "\($0)" } |
@@ -0,0 +1,548 @@ | |||
import CTensorFlow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This missed a license header, fixed in #209.
case .concrete(let h, _): | ||
return h | ||
case .symbolic(let op, let index, _): | ||
assert(false, "TODO: to be send out in a separate PR.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fatalError
instead of assert(false, ...)
.
First of a series of PRs to implement LazyTensor. This PR introduces the
LazyTensor
andLazyTensorOperation
types and associated tests.