swift-models
swift-models copied to clipboard
Traced function with only constants fails
Imported from JIRA https://bugs.swift.org/browse/TF-643
| Type: | Bug | Priority: | Minor |
|---|---|---|---|
| Reporter: | Brennan Saeta | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None |
struct CifarExample: TensorGroup {
var image: Tensor<Float> = Tensor()
var label: Tensor<Int32> = Tensor()
}
extension CifarExample {
var _tensorHandles: [TensorFlow._AnyTensorHandle] { [] }
init<C>(_handles: C) where C : RandomAccessCollection, C.Element : TensorFlow._AnyTensorHandle {
self.init()
}
}
let trainDataset = Dataset(fixedLengthFiles: trainPaths, recordBytes: recordBytes).map(parallelCallCount: 32) { (fixedRecord: StringTensor) -> CifarExample in
// Ignore the inputs, just return constants
let label: Tensor<Int32> = Tensor([1])
let image: Tensor<Float> = Tensor([1, 2, 3])
return CifarExample(image: image, label: label)
}.batched(32)
crashes with the following error:
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:566] Initializing global context.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:620] Allowing growth for GPU memory allocator.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:654] There are 1 devices.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:662] Device 0 has type CPU and name /job:localhost/replica:0/task:0/device:CPU:0.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:1101] Calling _TFCEagerExecute() over:
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:1106] [Run with TF_CPP_MIN_LOG_LEVEL=0 to have TFEOps printed out]
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:1115] Executing eager op 0x00007fa13f7c6320.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:789] Tracing over a function with 1 inputs.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:91] Instiantiating TraceContext with 1 input tensors.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:810] Running tracee in tracing mode.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:703] Getting 2 C handles.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:706] Unpacking handles into buffer.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:709] Copying buffer content to output handles.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:714] Copying the 0-th C handle 0x00007fa13d915138 with concrete=true.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:721] Copying the 0-th C handle 0x00007fa13d915138 with concrete=true to C handle create 0x00007fa13d914f88.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:714] Copying the 1-th C handle 0x00007fa13ddfe958 with concrete=true.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:721] Copying the 1-th C handle 0x00007fa13ddfe958 with concrete=true to C handle create 0x00007fa13daa4760.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:46] De-initializing TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/TensorHandle.swift:48] Returning from deinit of TensorHandle.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:813] Finalizing trace graph function.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:150] Finalizing trace graph func MyTraceFn_TAP_0, with 1 tracee inputs and 0 additional inputs, and up to 2 return values.
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:173] The traced function is:
MyTraceFn_TAP_0(input_0:string) -> () {
}
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:1127] Calling _GetGlobalEagerContext()
[third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift:311] Adding 0 additional input tensors.
Fatal error: Node 'output_const_1' (type: 'Const', num of outputs: 1) does not have output 1
Encountered while processing output 1 from function 'specialized_tffunc_1': file third_party/swift/tensorflow_apis/Sources/TensorFlow/Core/Runtime.swift, line 374
Current stack trace:
...