11/**
22 * @license
3- * Copyright 2018 Google Inc. All Rights Reserved.
3+ * Copyright 2019 Google Inc. All Rights Reserved.
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
66 * You may obtain a copy of the License at
@@ -20,7 +20,7 @@ import {BackendTimingInfo, DataMover, DataType, fill, KernelBackend, ones, Rank,
2020import { EPSILON_FLOAT32 } from '@tensorflow/tfjs-core/dist/backends/backend' ;
2121import { Conv2DInfo , Conv3DInfo } from '@tensorflow/tfjs-core/dist/ops/conv_util' ;
2222import { Activation , FusedBatchMatMulConfig } from '@tensorflow/tfjs-core/dist/ops/fused_util' ;
23- import { Tensor5D } from '@tensorflow/tfjs-core/dist/tensor' ;
23+ import { StringTensor , Tensor5D } from '@tensorflow/tfjs-core/dist/tensor' ;
2424import { BackendValues , upcastType } from '@tensorflow/tfjs-core/dist/types' ;
2525import { isArray , isNullOrUndefined } from 'util' ;
2626
@@ -1707,6 +1707,20 @@ export class NodeJSKernelBackend extends KernelBackend {
17071707 return this . executeSingleOutput ( 'LinSpace' , opAttrs , inputs ) as Tensor1D ;
17081708 }
17091709
1710+ encodeBase64 < T extends StringTensor > ( str : StringTensor | Tensor , pad = false ) :
1711+ T {
1712+ const opAttrs =
1713+ [ { name : 'pad' , type : this . binding . TF_ATTR_BOOL , value : pad } ] ;
1714+ return this . executeSingleOutput ( 'EncodeBase64' , opAttrs , [ str as Tensor ] ) as
1715+ T ;
1716+ }
1717+
1718+ decodeBase64 < T extends StringTensor > ( str : StringTensor | Tensor ) : T {
1719+ const opAttrs : TFEOpAttr [ ] = [ ] ;
1720+ return this . executeSingleOutput ( 'DecodeBase64' , opAttrs , [ str as Tensor ] ) as
1721+ T ;
1722+ }
1723+
17101724 fromPixels (
17111725 pixels : ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement ,
17121726 numChannels : number ) : Tensor3D {
0 commit comments