Code Monkey home page Code Monkey logo

aiscm's Introduction

The _    ___
   / \  |_ _|___  ___ _ __ ___
  / _ \  | |/ __|/ __| '_ ` _ \
 / ___ \ | |\__ \ (__| | | | | |
/_/   \_\___|___/\___|_| |_| |_| extension

GPLv3

AIscm is a Guile extension for numerical arrays and tensors. Performance is achieved by using the LLVM JIT compiler.

AIscm

Download and installation

See doc/installation.md or website for installation instructions.

Creating a Docker container

make -f Makefile.docker run

Within the tests folder, you'll find that all unit tests have already been run; you might also have seen the respective log output during the Docker build. Integration tests are not yet completely running within Docker, but you can e.g. run one using:

cd tests/integration/
make 2d_array.tmp

Run tests

Unit tests

You can run all tests like this

make check -j

One can use recheck to run only the test suites which have not completed successfully:

make recheck -j

To run a single test suite, you can delete the log file and regenerate it using make:

cd tests
rm -f test_core.log && make test_core.log
cd ..

Integration tests

Running the integration tests requires a graphical display, keyboard interaction, a camera, and a sound device.

make integration

One can use reintegration to run only the integration tests which have not completed successfully:

make reintegration

See also

aiscm's People

Contributors

frankruben avatar nalaginrut avatar wedesoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

aiscm's Issues

fonc

c compiler -> big system
jit -> small system, essentials, sse <-> fonc

integer size bug

(+ (seq (rgb (integer 32 unsigned)) (rgb 1 2 3)) (seq (integer 16 signed) 0))

Pulseaudio input

Investigate why Pulseaudio input is not working any more (under Debian 12).

test failures with tensorflow 1.9.0

Hi,

I just built the latest commit of AIscm with tensorflow 1.9.0 and I'm getting a total of 9 test failures:

test-name: derivative of variable
location: tests/test_tensorflow.scm:141
source:
+ (test-eqv
+   "derivative of variable"
+   -6.0
+   (let* ((s (make-session))
+          (w (tf-variable #:dtype <double> #:shape '()))
+          (c (tf-const #:dtype <double> #:value 0.0))
+          (x (tf-placeholder #:dtype <double>))
+          (g (tf-add-gradient (tf-square (tf-sub x w)) w)))
+     (run s '() (tf-assign w c))
+     (run s (list (cons x 3.0)) g)))
expected-value: -6.0
actual-value: #f
actual-error:
+ (misc-error
+   "tf-run"
+   "Node 'gradients/OnesLike' is not unique"
+   ()
+   #f)
result: FAIL

test-name: derivative for list of variables
location: tests/test_tensorflow.scm:150
source:
+ (test-equal
+   "derivative for list of variables"
+   (list 6.0)
+   (let* ((s (make-session))
+          (x (tf-placeholder #:dtype <double>))
+          (g (tf-add-gradient (tf-square x) (list x))))
+     (run s (list (cons x 3.0)) g)))
expected-value: (6.0)
actual-value: #f
actual-error:
+ (misc-error
+   "tf-run"
+   "Node 'gradients/OnesLike' is not unique"
+   ()
+   #f)
result: FAIL

test-name: convert array to tensor constant
location: tests/test_tensorflow.scm:162
source:
+ (test-equal
+   "convert array to tensor constant"
+   '((1 2) (3 4))
+   (let ((s (make-session))
+         (a (tf-const
+              #:dtype
+              <int>
+              #:value
+              (arr <int> 1 2 3 4))))
+     (to-list
+       (run s '() (tf-reshape a (arr <int> 2 2))))))
expected-value: ((1 2) (3 4))
actual-value: #f
actual-error:
+ (misc-error
+   "tf-run"
+   "Node 'gradients/OnesLike' is not unique"
+   ()
+   #f)
result: FAIL

test-name: convert scalar to tensor constant
location: tests/test_tensorflow.scm:167
source:
+ (test-eqv
+   "convert scalar to tensor constant"
+   5
+   (let ((s (make-session)))
+     (run s '() (tf-add 2 3))))
expected-value: 5
actual-value: #f
actual-error:
+ (misc-error
+   "tf-run"
+   "Node 'gradients/OnesLike' is not unique"
+   ()
+   #f)
result: FAIL

test-name: convert list of scalars to list of constants
location: tests/test_tensorflow.scm:169
source:
+ (test-eqv
+   "convert list of scalars to list of constants"
+   5
+   (let ((s (make-session)))
+     (run s '() (tf-add-n (list 2 3)))))
expected-value: 5
actual-value: #f
actual-error:
+ (misc-error
+   "tf-run"
+   "Node 'gradients/OnesLike' is not unique"
+   ()
+   #f)
result: FAIL

test-name: top-k returns two values
location: tests/test_tensorflow.scm:173
source:
+ (test-assert
+   "top-k returns two values"
+   (let ((s (make-session)))
+     (list? (run s '() (tf-top-kv2 (arr <int> 2 5 3) 2)))))
actual-value: #f
actual-error:
+ (misc-error
+   "tf-run"
+   "Node 'gradients/OnesLike' is not unique"
+   ()
+   #f)
result: FAIL

test-name: top-k returns two different values
location: tests/test_tensorflow.scm:176
source:
+ (test-equal
+   "top-k returns two different values"
+   '((5 3) (1 2))
+   (let ((s (make-session)))
+     (map to-list
+          (run s
+               '()
+               (tf-top-kv2 (arr 2 5 3) 2 #:sorted #t)))))
expected-value: ((5 3) (1 2))
actual-value: #f
actual-error:
+ (misc-error
+   "tf-run"
+   "Node 'gradients/OnesLike' is not unique"
+   ()
+   #f)
result: FAIL

test-name: get first output of operation by name
location: tests/test_tensorflow.scm:182
source:
+ (test-equal
+   "get first output of operation by name"
+   42
+   (let ((s (make-session))
+         (c (tf-const
+              #:dtype
+              <int>
+              #:value
+              42
+              #:name
+              "test-const")))
+     (run s
+          '()
+          (tf-graph-operation-by-name "test-const"))))
expected-value: 42
actual-value: #f
actual-error:
+ (misc-error
+   "tf-run"
+   "Node 'gradients/OnesLike' is not unique"
+   ()
+   #f)
result: FAIL

test-name: determine string length
location: tests/test_tensorflow.scm:231
source:
+ (test-eqv
+   "determine string length"
+   4
+   (let ((s (make-session)))
+     (run s '() (tf-string-length "test"))))
expected-value: 4
actual-value: #f
actual-error:
+ (unbound-variable
+   #f
+   "Unbound variable: ~S"
+   (tf-string-length)
+   #f)
result: FAIL

Most of these are the same error. I know that you're using a more recent version of Tensorflow than what I have here, but perhaps we can still make it work somehow. (We haven't been able to build anything more recent from source, because Bazel is very difficult to package.)

We also have Tensorflow Lite 2.5 in Guix, but the API differs enough that I can't use it as a drop-in replacement.

Do you happen to know what these test failures mean and how to work around them? And: would you be interested in supporting Tensorflow Lite going forward? That would be lovely, as it's quite a bit easier to build than the big Tensorflow package.

Thanks for your time!
Ricardo

aiscm 0.24.2 does not build with OpenCV 4.6.0

Hi I was trying to update OpenCV in guix to 4.6.0 from 4.5.4.

The Guix QA build checker shows aiscm would fail to build with OpenCV 4.6.0, with error

https://bordeaux.guix.gnu.org/build/6d64c5dc-818b-470d-b55c-be5b4cccf643

libtool: link: ( cd ".libs" && rm -f "libguile-aiscm-tensorflow.la" && ln -s "../libguile-aiscm-tensorflow.la" "libguile-aiscm-tensorflow.la" )
libtool: link: ( cd ".libs" && rm -f "libguile-aiscm-core.la" && ln -s "../libguile-aiscm-core.la" "libguile-aiscm-core.la" )
opencv.cpp:364:16: error: no member named 'drawAxis' in namespace 'cv::aruco'
cv::aruco::drawAxis(img, camera, distortion, rvec, tvec, scm_to_double(scm_len));

Looking at OpenCV sources from 4.5.4 and 4.6.0, it appears

cv::aruco::drawAxis()

was an API in opencv-contrib and was removed around OpenCV 4.6.0 or so. It is probably an API not guaranteed to be stable.

Probably a good idea not to reference such APIs.

FFmpeg bindings

Restore the FFmpeg bindings from Git history and update for recent FFmpeg API changes.

ffmpeg test failures

I'm trying to upgrade the Guix package for aiscm, but I'm getting an unspecified test failure:

PASS: test_ffmpeg_out.scm - Writing a 2D array with 'write-image' returns the input array
PASS: test_ffmpeg_out.scm - Writing an image with 'write-image' returns the input image
make[4]: *** [Makefile:848: test_ffmpeg_out.log] Aborted
make[4]: *** Deleting file 'test_ffmpeg_out.log'
make[4]: *** Waiting for unfinished jobs....

This seems to be due to 6eb20d6.
I tried building with ffmpeg 5.1, 4.4.2, and 3.4.11. Building with 5.1 fails, and with 4.4 or 3.4 I'm getting the Abort while running tests.

Could you please tell me what version of ffmpeg is expected to work with the latest version of aiscm?
Thank you!

How to build tensorflow and opencv bindings?

Hi,

I just packaged aiscm for Guix. I did add tensorflow (only version 1.9) and OpenCV (version 4.5.4) to the build inputs, but I don't see any bindings for tensorflow or opencv being built. I also don't see any options in the build system to enable them. Am I missing something obvious?

~~ Ricardo

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.