@tensorflow/tfjs-core
Advanced tools
Comparing version 0.0.2 to 0.6.0-alpha7
import { BrowserUtil } from './browser_util'; | ||
import * as contrib from './contrib'; | ||
import * as xhr_dataset from './data/xhr-dataset'; | ||
@@ -34,3 +33,3 @@ import * as environment from './environment'; | ||
export { version as version_core }; | ||
export { contrib, conv_util, environment, gpgpu_util, test_util, util, webgl_util, xhr_dataset }; | ||
export { conv_util, environment, gpgpu_util, test_util, util, webgl_util, xhr_dataset }; | ||
export * from './ops/ops'; | ||
@@ -37,0 +36,0 @@ export * from './train'; |
@@ -7,4 +7,2 @@ "use strict"; | ||
var browser_util_1 = require("./browser_util"); | ||
var contrib = require("./contrib"); | ||
exports.contrib = contrib; | ||
var xhr_dataset = require("./data/xhr-dataset"); | ||
@@ -11,0 +9,0 @@ exports.xhr_dataset = xhr_dataset; |
import { Conv2DInfo } from '../ops/conv_util'; | ||
import { DataId, Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D } from '../tensor'; | ||
import * as types from '../types'; | ||
import { DataType, TypedArray } from '../types'; | ||
@@ -92,2 +93,4 @@ import { BackendTimingInfo, KernelBackend } from './backend'; | ||
avgPoolBackprop(dy: Tensor4D, x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; | ||
cast<T extends Tensor<types.Rank>>(x: T, dtype: DataType): T; | ||
reshape<T extends Tensor<types.Rank>, R extends types.Rank>(x: T, shape: types.ShapeMap[R]): Tensor<R>; | ||
minPool(x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; | ||
@@ -94,0 +97,0 @@ avgPool(x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; |
@@ -49,2 +49,3 @@ "use strict"; | ||
var util = require("../util"); | ||
var backend_util = require("./backend_util"); | ||
var MathBackendCPU = (function () { | ||
@@ -1191,2 +1192,8 @@ function MathBackendCPU() { | ||
}; | ||
MathBackendCPU.prototype.cast = function (x, dtype) { | ||
return backend_util.castTensor(x, dtype, this); | ||
}; | ||
MathBackendCPU.prototype.reshape = function (x, shape) { | ||
return backend_util.reshapeTensor(x, shape); | ||
}; | ||
MathBackendCPU.prototype.minPool = function (x, convInfo) { | ||
@@ -1193,0 +1200,0 @@ return this.pool(x, convInfo, 'min'); |
import { TimingInfo } from '../engine'; | ||
import { Conv2DInfo } from '../ops/conv_util'; | ||
import { DataId, Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D } from '../tensor'; | ||
import * as types from '../types'; | ||
import { DataType, TypedArray } from '../types'; | ||
@@ -121,2 +122,4 @@ import { KernelBackend } from './backend'; | ||
avgPoolBackprop(dy: Tensor4D, x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; | ||
cast<T extends Tensor<types.Rank>>(x: T, dtype: DataType): T; | ||
reshape<T extends Tensor<types.Rank>, R extends types.Rank>(x: T, shape: types.ShapeMap[R]): Tensor<R>; | ||
resizeBilinear(x: Tensor4D, newHeight: number, newWidth: number, alignCorners: boolean): Tensor4D; | ||
@@ -123,0 +126,0 @@ multinomial(probs: Tensor2D, numSamples: number, seed: number): Tensor2D; |
@@ -44,2 +44,3 @@ "use strict"; | ||
var util = require("../util"); | ||
var backend_util = require("./backend_util"); | ||
var argminmax_gpu_1 = require("./webgl/argminmax_gpu"); | ||
@@ -681,2 +682,8 @@ var avg_pool_backprop_gpu_1 = require("./webgl/avg_pool_backprop_gpu"); | ||
}; | ||
MathBackendWebGL.prototype.cast = function (x, dtype) { | ||
return backend_util.castTensor(x, dtype, this); | ||
}; | ||
MathBackendWebGL.prototype.reshape = function (x, shape) { | ||
return backend_util.reshapeTensor(x, shape); | ||
}; | ||
MathBackendWebGL.prototype.resizeBilinear = function (x, newHeight, newWidth, alignCorners) { | ||
@@ -683,0 +690,0 @@ var program = new resize_bilinear_gpu_1.ResizeBilinearProgram(x.shape, newHeight, newWidth, alignCorners); |
import { Conv2DInfo } from '../ops/conv_util'; | ||
import { DataId, Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D } from '../tensor'; | ||
import { DataType, TypedArray } from '../types'; | ||
import { DataType, Rank, ShapeMap, TypedArray } from '../types'; | ||
export interface BackendTimingInfo { | ||
@@ -89,2 +89,4 @@ kernelMs: number; | ||
avgPoolBackprop(dy: Tensor4D, x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; | ||
reshape<T extends Tensor, R extends Rank>(x: T, shape: ShapeMap[R]): Tensor<R>; | ||
cast<T extends Tensor>(x: T, dtype: DataType): T; | ||
tile<T extends Tensor>(x: T, reps: number[]): T; | ||
@@ -91,0 +93,0 @@ pad<T extends Tensor>(x: T, paddings: Array<[number, number]>, constantValue: number): T; |
@@ -203,3 +203,3 @@ "use strict"; | ||
}; | ||
return environment_1.ENV.engine.runKernel(function (backend) { return tensor_1.Tensor.make(shape, { dataId: x.dataId }, x.dtype); }, { x: x }, grad); | ||
return environment_1.ENV.engine.runKernel(function (backend) { return backend.reshape(x, shape); }, { x: x }, grad); | ||
}; | ||
@@ -210,20 +210,6 @@ ArrayOps.squeeze = function (x, axis) { | ||
ArrayOps.cast = function (x, dtype) { | ||
var forw = function (backend) { | ||
if (!util.hasEncodingLoss(x.dtype, dtype)) { | ||
return tensor_1.Tensor.make(x.shape, { dataId: x.dataId }, dtype); | ||
} | ||
if (dtype === 'int32') { | ||
return backend.int(x); | ||
} | ||
else if (dtype === 'bool') { | ||
return backend.notEqual(x, ArrayOps.scalar(0, x.dtype)); | ||
} | ||
else { | ||
throw new Error("Error in Cast: unknown dtype argument (" + dtype + ")"); | ||
} | ||
}; | ||
var grad = function (dy) { | ||
return { x: function () { return dy.clone(); } }; | ||
}; | ||
return environment_1.ENV.engine.runKernel(forw, { x: x }, grad); | ||
return environment_1.ENV.engine.runKernel(function (backend) { return backend.cast(x, dtype); }, { x: x }, grad); | ||
}; | ||
@@ -230,0 +216,0 @@ ArrayOps.tile = function (x, reps) { |
@@ -1,2 +0,2 @@ | ||
declare const version = "0.0.2"; | ||
declare const version = "0.6.0-alpha7"; | ||
export { version }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var version = '0.0.2'; | ||
var version = '0.6.0-alpha7'; | ||
exports.version = version; |
{ | ||
"name": "@tensorflow/tfjs-core", | ||
"version": "0.0.2", | ||
"version": "0.6.0-alpha7", | ||
"description": "Hardware-accelerated JavaScript library for machine intelligence", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
1596966
214
26941