swift-apis
swift-apis copied to clipboard
Problems in StringTensor
I'm trying to use _Raw.histogramSummary but find problems of StringTensor.
import TensorFlow
let tag = StringTensor("tag")
print("tag:", tag)
print("tag.scalars:", tag.scalars)
let values = Tensor<Float>(randomNormal: [100])
let summary: StringTensor = _Raw.histogramSummary(tag: tag, values)
print("summary:", summary)
print("summary.scalars", summary.scalars)
$ swift main.swift
tag: StringTensor(handle: TensorFlow.TensorHandle<Swift.String>(handle: TensorFlow.TFETensorHandle))
tag.scalars: [""]
summary: StringTensor(handle: TensorFlow.TensorHandle<Swift.String>(handle: TensorFlow.TFETensorHandle))
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.6.xctoolchain/usr/bin/swift -frontend -interpret main.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main
1. Swift version 5.1.1-dev (Swift 7b97b0ced0)
0 swift 0x000000010e044785 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 swift 0x000000010e043a35 llvm::sys::RunSignalHandlers() + 85
2 swift 0x000000010e044d68 SignalHandler(int) + 264
3 libsystem_platform.dylib 0x00007fff655bdb5d _sigtramp + 29
4 libsystem_platform.dylib 000000000000000000 _sigtramp + 2594448576
5 libswiftCore.dylib 0x0000000116bb243e swift_bridgeObjectRetain + 62
6 libswiftCore.dylib 0x0000000116b3267c $sSJwcp + 28
7 libswiftCore.dylib 0x0000000116b585ac swift_arrayInitWithCopy + 108
8 libswiftCore.dylib 0x0000000116a9e1f9 $sSR13_copyContents12initializingSR8IteratorVyx_G_SitSryxG_tF + 57
9 libswiftCore.dylib 0x0000000116a9e334 $sSryxGSTsST13_copyContents12initializing8IteratorQz_SitSry7ElementQzG_tFTWTm + 36
10 libswiftCore.dylib 0x000000011688ed91 $ss32_copyCollectionToContiguousArrayys0dE0Vy7ElementQzGxSlRzlF + 369
11 libswiftCore.dylib 0x00000001168821d3 $sSaySayxGqd__c7ElementQyd__RszSTRd__lufC + 19
12 libswiftTensorFlow.dylib 0x0000000117112b38 $sqd__SayxGIegio_qd__AAIegno_7ElementQyd__RszSTRd__r__lTR + 88
13 libswiftTensorFlow.dylib 0x0000000117112b5b $sSRy6ScalarQzGSayABGIegno_AcDIegyo_10TensorFlow20_ShapedArrayProtocolRzlTR + 27
14 libswiftTensorFlow.dylib 0x0000000117112b83 $sSRy6ScalarQzGSayABGs5Error_pIgyozo_AcDsAE_pIegyrzo_10TensorFlow20_ShapedArrayProtocolRzlTR + 19
15 libswiftTensorFlow.dylib 0x00000001172767fe $sSRy6ScalarQzGSayABGs5Error_pIgyozo_AcDsAE_pIegyrzo_10TensorFlow20_ShapedArrayProtocolRzlTRTA + 46
16 libswiftTensorFlow.dylib 0x000000011711ebb2 $s10TensorFlow11ShapedArrayV23withUnsafeBufferPointeryqd__qd__SRyxGKXEKlFqd__AEKXEfU_ + 50
17 libswiftTensorFlow.dylib 0x000000011727769d $s10TensorFlow11ShapedArrayV23withUnsafeBufferPointeryqd__qd__SRyxGKXEKlFqd__AEKXEfU_TA + 61
18 libswiftTensorFlow.dylib 0x0000000117112484 $s10TensorFlow0A6BufferC010withUnsafeC7Pointeryqd__qd__SRyxGKXEKlF + 836
19 libswiftTensorFlow.dylib 0x0000000117119058 $s10TensorFlow11ShapedArrayV23withUnsafeBufferPointeryqd__qd__SRyxGKXEKlF + 184
20 libswiftTensorFlow.dylib 0x0000000117118f51 $s10TensorFlow11ShapedArrayVyxGAA01_cD8ProtocolA2aEP23withUnsafeBufferPointeryqd__qd__SRy6ScalarQzGKXEKlFTW + 49
21 libswiftTensorFlow.dylib 0x0000000117108e8d $s10TensorFlow20_ShapedArrayProtocolPAAE7scalarsSay6ScalarQzGvg + 365
22 libswiftTensorFlow.dylib 0x000000011712bef3 $s10TensorFlow06StringA0V7scalarsSaySSGvg + 83
23 libswiftTensorFlow.dylib 0x00000001177e848b $s10TensorFlow06StringA0V7scalarsSaySSGvg + 7063019
24 swift 0x000000010a366108 llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) + 456
25 swift 0x000000010a3691a1 llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char const* const*) + 1297
26 swift 0x000000010a35bf7f swift::RunImmediately(swift::CompilerInstance&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, swift::IRGenOptions&, swift::SILOptions const&) + 3455
27 swift 0x000000010a351a0d performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, bool, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 2573
28 swift 0x000000010a346fce performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 7118
29 swift 0x000000010a344486 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3046
30 swift 0x000000010a2e9989 main + 729
31 libdyld.dylib 0x00007fff653d23d5 start + 1
32 libdyld.dylib 0x000000000000000a start + 2596461622
Segmentation fault: 11
tag.scalars's content is empty stringsummary.scalarscauses crash
On colab, tag.scalar causes crash.
tag: StringTensor(handle: TensorFlow.TensorHandle<Swift.String>(handle: TensorFlow.TFETensorHandle))
Current stack trace:
frame #19: 0x00007f2834f48208 $__lldb_expr13`main at <Cell 1>:5:27
Coming at this from a different direction: it looks like you're interested in support for TensorBoard summaries. If we were able to add the ability to write summaries without the use of StringTensor (or _Raw operations), would that address your core need?
If we were able to add the ability to write summaries without the use of StringTensor (or _Raw operations), would that address your core need?
Perhaps yes.
I already have summary types in my library. I just want to avoid re-implementing histogram computation.