Comments (8)
A quick question about this: what would non-alphanumeric characters be replaced with? Considering what characters https://github.com/tensorflow/tensorflow/blob/v1.8.0/tensorflow/core/graph/graph_constructor.cc#L57 accepts, should emoji, etc. be removed entirely or converted to some ascii-friendly alphanumeric equivalent during name mangling?
from swift.
Removal is certainly the simplest solution.
The regex for allowable names is quite restrictive (from here): "[A-Za-z0-9.][A-Za-z0-9_./]*"
.
I don't know of any standard string escaping conventions that map onto just alphanumeric characters.
Does anyone have a better alternative to removing invalid characters?
from swift.
I'm taking this on because it blocks #8.
The compiler-integrated REPL has the filename <REPL Input>
, which is invalid.
$ build/buildbot_linux/swift-linux-x86_64/bin/swift
*** You are running Swift's integrated REPL, ***
*** intended for compiler and stdlib ***
*** development and testing purposes only. ***
*** The full REPL is built as part of LLDB. ***
*** Type ':help' for assistance. ***
(swift) import TensorFlow
(swift) let x = Tensor(1)
2018-05-01 21:34:33.631820: E tensorflow/core/common_runtime/executor.cc:660] Executor failed to create kernel. Invalid argument: Node 'op.<REPL Input>.1.16': Node name contains invalid characters
[[Node: tfc_func_main.tf_partition = main.tf_partition[_device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Fatal error: Node 'op.<REPL Input>.1.16': Node name contains invalid characters
from swift.
The only thing I could think of was (for emoji specifically) using the codepoint number (e.g. 🐦 becomes U1F426
). On second thought, though, that doesn't seem like it'd provide a lot of value over just removing the character.
On an unrelated note, it's great to be able to see and follow the development of this. Looking forward to trying out all of the wonderful new features!
from swift.
@dan-zheng To unblock compiler integrated REPL, the shortest path we can take is to replace spaces with underscores. This issue should be left open. Thanks!
from swift.
An alternative to removing invalid characters is to replace them with _
. That may look nicer for some filenames, but falls apart for Unicode characters.
<REPL Input>
- Removal:
REPLInput
- Underscore:
_REPL_Input_
- Removal:
Swift for TensorFlow.playground
- Removal:
SwiftforTensorFlow.playground
- Underscore:
Swift_for_TensorFlow.playground
- Removal:
😃🐦😎asdf
- Removal:
asdf
- Underscore:
____________asdf
- Removal:
I'll go ahead and use underscores for now to unblock #8, but I'll leave this issue open.
A robust escaping mechanism should handle unicode characters (using llvm::UTF8
or some other means) and be reversible.
from swift.
Replaced invalid characters with underscores in 5233a8f.
from swift.
@dan-zheng Could you cherry-pick and move this one to JIRA too?
from swift.
Related Issues (20)
- Close all open issues and pull requests since this repository has been moved
- Python linking in xcode HOT 5
- Internal error when `public`s are removed from the catch model HOT 3
- Configuring swift-format's line breaking rule
- Add build instructions to Readme
- Error building swift-format HOT 1
- Translation of Google Swift Style Guide
- Unexpected newline before opening brace for method calls with trailing closures
- The rule NoAccessLevelOnExtensionDeclaration doesn't work
- testEagerLoop() in crashers.swift crashers in TFLowerGraph.cpp, after supporting TF tensor receives HOT 1
- Use SILPrinter callback mechanism to annotate the printed SIL code HOT 2
- Bridge Python `numpy.ndarray` to `Array` and `Tensor` HOT 2
- Crash when doing basic Swift's String Interpolation. HOT 10
- [Ubuntu] `Python.import("numpy")` fails in the REPL HOT 5
- Non-data dependent code with side effects - should they sync? HOT 8
- Implement UseOnlySpaces HOT 1
- Implement UseTripleSlashForDocumentationComments HOT 1
- implement NeverUseForceTry HOT 1
- Implement NeverUseImplicitlyUnwrappedOptionals HOT 1
- Implement CyclomaticComplexityWarning.swift HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift.