Posts

Showing posts from February, 2020

graal, scala and python together note

graal, scala and python together note If you use graal with scala and python, you can import modules but you need to do it differently. In python, the import sys is actually a statement so it has no return value to return to graal. Instead, you need to use the “function” version: Python 3.7 . 6 ( default , Jan 30 2020 , 09 : 44 : 41 ) [ GCC 9.2 . 1 20190827 ( Red Hat 9.2 . 1 - 1 ) ] on linux Type "help" , "copyright" , "credits" or "license" for more information . >> > s = __import__ ( "sys" ) >> > s . version '3.7.6 (default, Jan 30 2020, 09:44:41) \n[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]' >> > So in graal via ammonite, do: @ import org . graalvm . polyglot . _ @ val cs = Context . create ( ) val sys_module = cs . eval ( "python" , """__import__("sys")""" ) @ sys_module . getMember ( "ve...

swift on linux

swift on linux This blog is a quick note on swift for linux. swift has been designated by google as a major machine learning language. google appears to be rewriting tensorflow in swift. More info is here: https://www.tensorflow.org/swift . While python is not going away, they are working hard in making python a smooth integration, much in the same way that the graal project is integrated in multiple languages into the jvm platform. When you want to run python code in swift, the tensorflow example on their web site assume you are use google colab which already has the swift-python interop module installed. You can also install “swift for tensorflow” from binaries provided on github. Check out https://github.com/tensorflow/swift/blob/master/Installation.md for instructions. If you are not using ubuntu, you may be out of luck as the build process for tensorflow can be complex. If you are able to install this version, you will get a swift version that already has...