{ "info": { "author": "Simon Perkins", "author_email": "simon.perkins@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Tensorflow Custom Operator Code Outline Generator\n=================================================\n\n.. image:: https://travis-ci.org/sjperkins/tfopgen.svg?branch=master\n :target: https://travis-ci.org/sjperkins/tfopgen\n\nWriting a tensorflow operator requires writing fair amounts of\nboilerplate C++ and CUDA code. This script generates code for the CPU\nand GPU version of a tensorflow operator. More specifically, given\ntensorflow ``inputs``, ``outputs`` and ``attribute``\\ s, it generates:\n\n- C++ Header file that defines the operator class, templated on Device.\n- C++ Header file that defines the CPU implementation of the operator.\n- C++ Source file with Shape Function, REGISTER\\_OP and\n REGISTER\\_KERNEL\\_BUILDER constructs.\n- Cuda Header that defines the GPU implementation of the operator,\n including a CUDA kernel.\n- Cuda Source file with GPU REGISTER\\_KERNEL\\_BUILDER's for the\n operator.\n- python unit test case, which constructs random input data, and calls\n the operator.\n- Makefile for compiling the operator into a shared library, using g++\n and nvcc.\n\nRequirements\n------------\n\nA tensorflow installation, required for building the operator.\n\n.. code:: bash\n\n pip install tensorflow\n\n\nInstallation\n------------\n\n.. code:: bash\n\n pip install tfopgen\n\nUsage\n-----\n\nThe user should provide a YAML configuration file defining the operator:\n\n- inputs and optionally, their shapes.\n- outputs and optionally, their outputs.\n- polymorphic type attributes.\n- other attributes.\n- documentation.\n\nFor example, we can define the outline for a ``ComplexPhase`` operator in the ``complex_phase.yml`` file.\n\n.. code:: yaml\n\n ---\n project: astronomy\n library: fourier\n name: ComplexPhase\n type_attrs:\n - \"FT: {float, double} = DT_FLOAT\"\n - \"CT: {complex64, complex128} = DT_COMPLEX64\"\n inputs:\n - [\"uvw: FT\", [null, null, 3]] # (ntime, nbl, 3)\n - [\"frequency: FT\", [null]] # (nchan, )\n - [\"lm: FT\", [null, 2]] # (nsrc, 2)\n outputs:\n - [\"complex_phase: CT\", [null, null, null, null]]\n doc: >\n Given tensors\n (1) of (U, V, W) baseline coordinates with shape (ntime, nbl, 3)\n (2) of (L, M) sky coordinates with shape (nsrc, 2)\n (3) of frequencies,\n compute the complex phase with shape (nsrc, ntime, nbl, nchan)\n\nWe can then run:\n\n.. code:: bash\n\n $ tfopgen complex_phase.yml\n\nto create the following directory structure and files:\n\n.. code:: bash\n\n $ tree fourier/\n fourier/\n \u251c\u2500\u2500 complex_phase_op_cpu.cpp\n \u251c\u2500\u2500 complex_phase_op_cpu.h\n \u251c\u2500\u2500 complex_phase_op_gpu.cu\n \u251c\u2500\u2500 complex_phase_op_gpu.cuh\n \u251c\u2500\u2500 complex_phase_op.h\n \u251c\u2500\u2500 Makefile\n \u2514\u2500\u2500 test_complex_phase.py\n\nThe ``project`` and ``library`` options specify C++ namespaces within\nwhich the operator is created. Additionally, the Makefile will create a\n``fourier.so`` shared library that can be loaded with ``tf.load_op_library('fourier.so')``.\n\nAny polymorphic type attributes should be supplied. The generator will\ntemplate the operators on type attributes. It will also generate\nconcrete permutations of REGISTER\\_KERNEL\\_BUILDER for both the CPU and\nGPU op using the actual types supplied in the type attributes (float,\ndouble, complex64 and complex128) below:\n\n.. code:: yaml\n\n type_attrs:\n - \"FT: {float, double} = DT_FLOAT\"\n - \"CT: {complex64, complex128} = DT_COMPLEX64\"\n\n\nThe operator inputs and their optional shapes should be specified as a\nlist containing a string defining the ``.Input`` directive, and a list\ndescribing the shape of the input tensor. A ``null`` value in the shape\nwill be translated into a python ``None``. If concrete dimensions are specified,\ncorresponding checks will be generated in the Shape Function associated with the\noperator.\n\n.. code:: yaml\n\n inputs:\n - [\"uvw: FT\", [null, null, 3]] # (ntime, nbl, 3)\n - [\"frequency: FT\", [null]] # (nchan, )\n - [\"lm: FT\", [null, 2]] # (nsrc, 2)\n\nThe operator outputs should similarly defined.\n\n.. code:: yaml\n\n outputs:\n - [\"complex_phase: CT\", [null, null, null, null]]\n\nGiven these inputs and outputs, CPU and GPU operators are created with\nnamed variables corresponding to the inputs and outputs. Additionally, a\nCUDA kernel with the given inputs and outputs is created, as well as a\nshape function checking the rank and dimensions of the supplied inputs.\n\n\nOther attributes may be specified (and will be output in the\nREGISTER\\_OP) directive, but are not catered for automatically by the\ngenerator code as the range of attribute behaviour is complex.\n\n.. code:: yaml\n\n op_other_attrs:\n - \"iterations: int32 >= 2\",\n\nFinally operator documentation may also be supplied.\n\n.. code:: yaml\n\n doc: >\n Given tensors\n (1) of (U, V, W) baseline coordinates with shape (ntime, nbl, 3)\n (2) of (L, M) sky coordinates with shape (nsrc, 2)\n (3) of frequencies,\n compute the complex phase with shape (nsrc, ntime, nbl, nchan)", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "tfopgen", "package_url": "https://pypi.org/project/tfopgen/", "platform": "", "project_url": "https://pypi.org/project/tfopgen/", "project_urls": null, "release_url": "https://pypi.org/project/tfopgen/0.2.6/", "requires_dist": null, "requires_python": "", "summary": "Generates tensorflow custom operator boilerplate", "version": "0.2.6" }, "last_serial": 4116553, "releases": { "0.1.0": [], "0.2.0": [ { "comment_text": "", "digests": { "md5": "602b4191c270e766807891b303c9759e", "sha256": "43dcaf5d1401bc8030206f825bcc173748e83f448eaa54b05332403f5cebe3c8" }, "downloads": -1, "filename": "tfopgen-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "602b4191c270e766807891b303c9759e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 19902, "upload_time": "2017-01-29T16:01:41", "url": "https://files.pythonhosted.org/packages/c2/e8/f628895bbe26a53fc279dfd90af11629a28020c6382997257c7321946719/tfopgen-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6378fab3222190eb0dc0319947e71d5d", "sha256": "0e094b96b681933f9b372e57925c3a1d386bd35d80513984521ff98c02d5e6a9" }, "downloads": -1, "filename": "tfopgen-0.2.0.tar.gz", "has_sig": false, "md5_digest": "6378fab3222190eb0dc0319947e71d5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14253, "upload_time": "2017-01-29T16:01:37", "url": "https://files.pythonhosted.org/packages/c4/1f/afa39ffeef9e8a3884832f78fe138979ee53a2c4e4b3246457a9586d111c/tfopgen-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "b3806e69e49b0af3304f716533262620", "sha256": "b233bdbb133f32462ca98e604a2a154361015051a6631143a01b2034fd69b7aa" }, "downloads": -1, "filename": "tfopgen-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b3806e69e49b0af3304f716533262620", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20177, "upload_time": "2017-01-29T16:42:11", "url": "https://files.pythonhosted.org/packages/9c/32/63dd0543bf3fbce8d184591410a1f41ac2e73895e69250bf911b1fa501e0/tfopgen-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "76d000c7bc971f6e8adc860e92cb4d77", "sha256": "f43a51f63cd6aa0b47572c82fa4c4ebb3f5d509b94bde0694b6235ae1eedcb66" }, "downloads": -1, "filename": "tfopgen-0.2.1.tar.gz", "has_sig": false, "md5_digest": "76d000c7bc971f6e8adc860e92cb4d77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14378, "upload_time": "2017-01-29T16:42:08", "url": "https://files.pythonhosted.org/packages/56/ad/897152263034aed1d25875d6d6dfb3490f07cb2346fa707298a46135fd61/tfopgen-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "af76f47c19698a9876ebc2dc2c50a4a8", "sha256": "ac9c789570b46ddc4b4dda90525275e96171f7c63b1b37f55caf1a054a3a4be3" }, "downloads": -1, "filename": "tfopgen-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "af76f47c19698a9876ebc2dc2c50a4a8", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20184, "upload_time": "2017-04-30T08:07:15", "url": "https://files.pythonhosted.org/packages/de/40/c2001f87fdd7a7a7be42800bd1150e222106078677380bfb4e5290eb0a55/tfopgen-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1b035d2d56c52f7a490d8f4845f05011", "sha256": "d127f05cf8b7748d334cc1159b41413184caaf6067c95536ce824cfd197a4eb7" }, "downloads": -1, "filename": "tfopgen-0.2.2.tar.gz", "has_sig": false, "md5_digest": "1b035d2d56c52f7a490d8f4845f05011", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14331, "upload_time": "2017-04-30T08:07:12", "url": "https://files.pythonhosted.org/packages/c7/60/320c3005cc61210f7e6314bfe53c76b3ac4dbca8a6f602e9fbc4a6d68c9f/tfopgen-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "9e989503f9bff00249ce8e9b7dd89c5a", "sha256": "121bbae6d324909319cce3225139d7f1782385773e70db7c05952f0cf1742242" }, "downloads": -1, "filename": "tfopgen-0.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9e989503f9bff00249ce8e9b7dd89c5a", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20204, "upload_time": "2017-04-30T08:27:55", "url": "https://files.pythonhosted.org/packages/80/0c/bd9acec0f2bef614289cefdb1eb7990bf960bba5cfcce4296dc3819f355e/tfopgen-0.2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61bbcb3210ec89ee5aa5632bb05fb611", "sha256": "3b2db5ef19ea75f72ffb851d50b63c2976fa76ad7f2157a87c3f02fd5bff81bc" }, "downloads": -1, "filename": "tfopgen-0.2.3.tar.gz", "has_sig": false, "md5_digest": "61bbcb3210ec89ee5aa5632bb05fb611", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14349, "upload_time": "2017-04-30T08:27:52", "url": "https://files.pythonhosted.org/packages/7c/e5/67aaa4b87a6e4a6f1af5aa0108a824c1325571ebb1ac17a31aa5b1e1a0b3/tfopgen-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "c9b23d298840fc998848cfe78c90a78c", "sha256": "5a0795f767e655586fc2f7636c249f6104c13c4dc177e8f065667f76902530ca" }, "downloads": -1, "filename": "tfopgen-0.2.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c9b23d298840fc998848cfe78c90a78c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20186, "upload_time": "2017-04-30T08:40:57", "url": "https://files.pythonhosted.org/packages/45/45/b01ee5023530448ef5897ec2ab04efc9667b5fe5558ce547845e5528a63f/tfopgen-0.2.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "157e247853fb43227dfb4363bcc106e1", "sha256": "35f9751ef64f9cfc0401e7b0abbbfb1c1f3a5d6930425d13a1a6b46eedf83a4a" }, "downloads": -1, "filename": "tfopgen-0.2.4.tar.gz", "has_sig": false, "md5_digest": "157e247853fb43227dfb4363bcc106e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14331, "upload_time": "2017-04-30T08:40:54", "url": "https://files.pythonhosted.org/packages/b1/34/5fdcce9493a65acc1c4de9933f086843b337bd217618e19c70d99212e390/tfopgen-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "2c3047a4ee11d255940ab059187f0792", "sha256": "bfdf27ab6c20fd370691d7420748a195468c61aef5e64d73cb4fa68c099c0f88" }, "downloads": -1, "filename": "tfopgen-0.2.5.tar.gz", "has_sig": false, "md5_digest": "2c3047a4ee11d255940ab059187f0792", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14400, "upload_time": "2018-07-30T08:14:57", "url": "https://files.pythonhosted.org/packages/64/66/e339e470615a6b4a77a195a4787568342d43395b3c8d0913c5efa3b9ca9e/tfopgen-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "3a1d70e25358819edbeba0b244a0b7af", "sha256": "2ab54de249df164c2c0b16770d6e3c4789a0423a7694a10eae5dbc25e475b3f7" }, "downloads": -1, "filename": "tfopgen-0.2.6.tar.gz", "has_sig": false, "md5_digest": "3a1d70e25358819edbeba0b244a0b7af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14392, "upload_time": "2018-07-30T13:48:22", "url": "https://files.pythonhosted.org/packages/c5/d5/a5a960ac5fc7edf68f1259b0d602c4aa0d051de11af19feedda4ecc7ce48/tfopgen-0.2.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3a1d70e25358819edbeba0b244a0b7af", "sha256": "2ab54de249df164c2c0b16770d6e3c4789a0423a7694a10eae5dbc25e475b3f7" }, "downloads": -1, "filename": "tfopgen-0.2.6.tar.gz", "has_sig": false, "md5_digest": "3a1d70e25358819edbeba0b244a0b7af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14392, "upload_time": "2018-07-30T13:48:22", "url": "https://files.pythonhosted.org/packages/c5/d5/a5a960ac5fc7edf68f1259b0d602c4aa0d051de11af19feedda4ecc7ce48/tfopgen-0.2.6.tar.gz" } ] }