Error when running MNIST
I am having the following error trying to run the MNIST algorithm and I am not sure what is causing it.
Reading data.
Constructing data tensors.
Precondition failed: The number of scalars does not match the shape.: file /swift-base/swift/stdlib/public/TensorFlow/Tensor.swift, line 101
Current stack trace:
0 libswiftCore.so 0x00007f9df09fbf40 _swift_stdlib_reportFatalErrorInFile + 115
1 libswiftCore.so 0x00007f9df09443dc <unavailable> + 3003356
2 libswiftCore.so 0x00007f9df09444ce <unavailable> + 3003598
3 libswiftCore.so 0x00007f9df078be12 <unavailable> + 1199634
4 libswiftCore.so 0x00007f9df090e6b2 <unavailable> + 2782898
5 libswiftCore.so 0x00007f9df078b259 <unavailable> + 1196633
6 libswiftTensorFlow.so 0x00007f9dede7fd50 __tf_tensor_from_scalars + 942
Current stack trace:
frame #4: 0x00007f9ddfd4563a $__lldb_expr377`specialized readMNIST(imagesFile:labelsFile:) at <Cell 12>:36
frame #6: 0x00007f9ddfd3b0ed $__lldb_expr377`main at <REPL>:60
so I got this working with xcode project. Are you linux?
if you're on xcode try this rename the MNIST.swift -> main.swift
run this brew install xcodegen
grab this file -> project.yml wget https://gist.githubusercontent.com/johndpope/f6e6e21daedf95d8a230b3eddd551574/raw/9ca1643ec4ab35b6c7587bb8a5f582247a8543c8/project.yml
then run xcodegen
then open xcode project change Project Settings > legacy build system
then goto **edit scheme > ** tick the
- use custom working directory
specify the project folder where main.swift file is (this gets around the search paths for mnist files)

caveats - the project.yml file currently hard codes the toolchain to /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.2.xctoolchain (I tried using the swift-latest but symlinks are out of date.)
Sorry for the late response, Actually I got this fixed in Xcode and Jupyter too. The main problem you see is
Precondition failed: The number of scalars does not match the shape.
which implies that tensors shape do not match which is possibly caused by corrupt loading. To fix this I download the training files from the original URL and ran it again.
caveats - the project.yml file currently hard codes the toolchain to /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.2.xctoolchain
Also that is a great point. Development toolchains are not working because they are bit outdated. So release packages are to go.