本文整理汇总了TypeScript中numjs.array函数的典型用法代码示例。如果您正苦于以下问题:TypeScript array函数的具体用法?TypeScript array怎么用?TypeScript array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: drawUntiedBias
function drawUntiedBias(node, layer){
// try to get good numbers for a grid
// http://stackoverflow.com/questions/2304052/check-if-a-number-has-a-decimal-place-is-a-whole-number
let gridX = 0, gridY = 0;
let gridXY = Math.sqrt(layer.shape[0]);
// not a whole number
if(gridXY % 1 != 0){
gridX = Math.floor(gridXY);
gridY = Math.ceil(gridXY);
}
else{
gridX = gridXY;
gridY = gridXY;
}
for (let filterInd = 0; filterInd < layer.shape[0]; filterInd++){
let img = normalizeImg(nj.array(layer.values).pick(filterInd));
let canv = document.createElement('canvas');
canv.setAttribute('width', img.shape[0] * 2);
canv.setAttribute('height', img.shape[1] * 2);
canv.getContext("2d").imageSmoothingEnabled = false;
nj.images.save(img, canv);
node.appendChild(canv);
if ((filterInd+1) % gridX == 0) { // +1 because we don't want to br on first (zero indexed)
node.appendChild(document.createElement('br'));
}
}
}
开发者ID:Islandman93,项目名称:NeuralNetLog,代码行数:27,代码来源:Drawing.ts
示例2: drawDense
function drawDense(node, layer){
let img = normalizeImg(nj.array(layer.values));
let canv = document.createElement('canvas');
canv.setAttribute('width', img.shape[0]);
canv.setAttribute('height', img.shape[1]);
canv.getContext("2d").imageSmoothingEnabled = false;
nj.images.save(img, canv);
node.appendChild(canv);
}
开发者ID:Islandman93,项目名称:NeuralNetLog,代码行数:9,代码来源:Drawing.ts
示例3: abs
import { abs } from 'numjs';
import * as nj from 'numjs';
const a = abs(2);
const arr = nj.arange(6);
arr.reshape(1, 2, 3);
// array([[[ 0, 1, 2],
// [ 3, 4, 5]]])
arr.T;
// array([[[ 0],
// [ 3]],
// [[ 1],
// [ 4]],
// [[ 2],
// [ 5]]])
arr.transpose(1, 0, 2);
// array([[[ 0, 1, 2]],
// [[ 3, 4, 5]]])
const b = nj.array([2, 3, 4]);
const c = nj.uint8([1, 2, 3]);
const d = nj.array<number[]>([[2], [3, 4]]);
开发者ID:minodisk,项目名称:DefinitelyTyped,代码行数:25,代码来源:numjs-tests.ts
示例4: abs
import { abs } from 'numjs';
import * as nj from 'numjs';
const a = abs(2);
const arr = nj.arange(6);
arr.reshape(1, 2, 3);
// array([[[ 0, 1, 2],
// [ 3, 4, 5]]])
arr.T;
// array([[[ 0],
// [ 3]],
// [[ 1],
// [ 4]],
// [[ 2],
// [ 5]]])
arr.transpose(1, 0, 2);
// array([[[ 0, 1, 2]],
// [[ 3, 4, 5]]])
const b = nj.array([2, 3, 4]);
const c = nj.uint8([1, 2, 3]);
开发者ID:IceCreamYou,项目名称:DefinitelyTyped,代码行数:23,代码来源:numjs-tests.ts
注:本文中的numjs.array函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论