Skip to content

Commit

Permalink
Rename src/binding.* to src/tf_binding.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mjschock authored and ry committed Mar 17, 2018
1 parent 4e303ac commit 26ee6c0
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ changes.
To run the website tests, point your browser to
http://localhost:8080/static/test.html#script=/test_website.js

To build the production website, `./tools/render_website.js prod` must be run.
To build the production website, `./tools/website_render.js prod` must be run.


### Adding An Op
Expand All @@ -118,7 +118,7 @@ ops. Here is a rough outline of how to add an op
respectively.

5. Add a test demonstrating the desired behavior in `src/api_test.ts`.
The tensorflow binding can be built using `./tools/build_binding.js`
The tensorflow binding can be built using `./tools/build_tf_binding.js`
and the test can be run by doing `ts-node src/api_test.ts MyTest`.
The DL test can be run by setting an environmental variable:
`PROPEL=dl ts-node src/api_test.ts MyTest`
Expand Down
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'targets': [
{
'target_name': 'tensorflow-binding',
'sources': [ 'src/binding.cc' ],
'sources': [ 'src/tf_binding.cc' ],
'include_dirs': [
'<(tensorflow_include_dir)',
'<(module_root_dir)',
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/tf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
limitations under the License.
*/
// TensorFlow backend.
import { assert, assertEqual, getDType } from "./tensor_util";
import {
AttrDef,
DTypeCode,
Handle,
} from "./binding";
import { assert, assertEqual, getDType } from "./tensor_util";
} from "./tf_binding";
import * as types from "./types";

export let binding;
export let ctx;

export function loadBinding(): boolean {
binding = require("./load_binding");
binding = require("./load_tf_binding");
if (binding) {
ctx = new binding.Context(); // Auto create context for now.
return true;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ if (process.argv.indexOf("clean") >= 0) {
}

(async() => {
run.sh("node ./tools/build_binding.js");
run.sh("node ./tools/build_tf_binding.js");
run.sh("node ./tools/website_render.js");
})();
8 changes: 4 additions & 4 deletions tools/build_binding.js → tools/build_tf_binding.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
// build script for binding.cc
// build script for tf_binding.cc
// There are literally two compile commands to call. Just call them here.

const { execSync } = require('child_process');
Expand All @@ -26,8 +26,8 @@ if (process.platform === "darwin" || process.platform === "linux") {
// Flags for both linux and mac.
let cflags = `
-c
-o Release/binding.o
../src/binding.cc
-o Release/tf_binding.o
../src/tf_binding.cc
-I${nodeInclude}
-I${run.root}
-I${run.root}/deps/libtensorflow/include
Expand All @@ -47,7 +47,7 @@ if (process.platform === "darwin" || process.platform === "linux") {
let ldflags = `
-L./Release
-o Release/tensorflow-binding.node
Release/binding.o
Release/tf_binding.o
-ltensorflow
-m64
`;
Expand Down
2 changes: 1 addition & 1 deletion tools/cpplint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node
const run = require("./run");
run.sh("python ./deps/cpplint/cpplint.py src/binding.cc src/check.h");
run.sh("python ./deps/cpplint/cpplint.py src/tf_binding.cc src/check.h");
8 changes: 4 additions & 4 deletions tools/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ if (clean) {
const v = run.version();
console.log("version", v);

// Build the binding.
run.sh("node tools/build_binding.js");
// Build the tensorflow binding.
run.sh("node tools/build_tf_binding.js");

function createPackageJson(src, dst, packageJson = {}) {
let p = JSON.parse(fs.readFileSync(src, "utf8"));
Expand Down Expand Up @@ -90,7 +90,7 @@ async function buildAndTest() {
});

const tfPkgFn = await npmPack(config.tfPkg, async distDir => {
fs.copyFileSync("src/load_binding.js", distDir + "/load_binding.js");
fs.copyFileSync("src/load_tf_binding.js", distDir + "/load_tf_binding.js");
// Copy over the TF binding.
fs.copyFileSync("build/Release/tensorflow-binding.node",
distDir + "/tensorflow-binding.node"
Expand All @@ -106,7 +106,7 @@ async function buildAndTest() {
}
createPackageJson("package.json", distDir + "/package.json", {
name: config.tfPkg,
main: "load_binding.js",
main: "load_tf_binding.js",
dependencies: { propel: v }
});
});
Expand Down
4 changes: 2 additions & 2 deletions tools/test_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import "./test_isomorphic";

import "../src/disk_experiment_test";

// Only on Node/TF should we run the binding_test.
// Only on Node/TF should we run the tf_binding_test.
import { backend } from "../src/api";
if (backend === "tf") {
import("../src/binding_test");
import("../src/tf_binding_test");
}

0 comments on commit 26ee6c0

Please sign in to comment.