UNPKG

@hoff97/tensor-js

Version:

PyTorch like deep learning inferrence library

32 lines 1.08 kB
import { UnaryOperation } from './unaryOperation'; export class AddMultiplyScalarOperation extends UnaryOperation { constructor(tensorConstructor, dtype, allocator) { super(tensorConstructor, dtype, allocator); } operation(input) { return `factor*${input} + add`; } calc(input) { return this.compute(input.input.shape, { X: input.input }, { factor: input.factor, add: input.add }); } getCompilationInfo(input) { const info = super.getCompilationInfo(input); return Object.assign(Object.assign({}, info), { factor: input.factor, add: input.add }); } getInputInfoString(input) { return `${super.getInputInfoString(input)}-${input.factor}-${input.add}`; } getVariables() { return ` ${this.getVarModifier('factor')} float factor; ${this.getVarModifier('add')} float add; `; } getUniformAttrs() { return [ { name: 'factor', type: 'float' }, { name: 'add', type: 'float' }, ]; } } //# sourceMappingURL=addMultiplyScalar.js.map