Skip to content

Commit

Permalink
Simplify move semantics.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Oct 28, 2023
1 parent 45dfa1c commit 5c9719d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nnc/FunctionalAddons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,10 @@ extension DynamicGraph.Group {
extension DynamicGraph.Tensor {
/// Explicitly do conversion between types.
public convenience init(from input: DynamicGraph.AnyTensor, streamContext: StreamContext? = nil) {
guard input.dataType != Element.dataType else {
self.init(input)
return
}
let params = CmdParamsFactory.factory.newParams()
let cmd = ccv_nnc_cmd(CCV_NNC_DATATYPE_CONVERSION_FORWARD, nil, params, 0)
let output = input.graph.variable(
Expand Down

0 comments on commit 5c9719d

Please sign in to comment.