GithubHelp home page GithubHelp logo

Comments (3)

dan-zheng avatar dan-zheng commented on August 18, 2024 1

@dynamicCallable is done as of apple/swift@2142075 and has been added to PythonObject.
You can now run the following:

$ swift
Welcome to Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44, Swift 70260a59ef). Type :help for assistance.
  1> import Python
  2. let np = Python.import("numpy")
np: Python.PythonObject = <module 'numpy' from '/Users/danielzheng/Library/Python/2.7/lib/python/site-packages/numpy/__init__.pyc'>
  3> let a = np.arange(15).reshape(3, 5)
a: Python.PythonObject =
[[ 0  1  2  3  4]
 [ 5  6  7  8  9]
 [10 11 12 13 14]]
  4> let b = np.array([6, 7, 8])
b: Python.PythonObject = [6 7 8]

Please download the latest Swift for TensorFlow packages to try it out!

from swift.

dan-zheng avatar dan-zheng commented on August 18, 2024

This is because @dynamicCallable is not yet implemented.

Until then, you'll need to write .call(with:) explicitly:
np.arange.call(with: 15).reshape.call(with: 3, 5)

@dynamicCallable is currently being implemented and should be pushed within a week! I'll update here when it's pushed.

from swift.

Honghe avatar Honghe commented on August 18, 2024

Got it, Thanks!

from swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.