2020-12-02 22:46:41 +01:00
|
|
|
import * as tf from '../../dist/tfjs.esm.js';
|
2020-08-26 00:24:48 +02:00
|
|
|
|
|
|
|
import { PointwiseConvParams } from './types';
|
|
|
|
|
|
|
|
export function pointwiseConvLayer(
|
|
|
|
x: tf.Tensor4D,
|
|
|
|
params: PointwiseConvParams,
|
|
|
|
strides: [number, number]
|
|
|
|
) {
|
|
|
|
return tf.tidy(() => {
|
|
|
|
|
|
|
|
let out = tf.conv2d(x, params.filters, strides, 'same')
|
|
|
|
out = tf.add(out, params.batch_norm_offset)
|
|
|
|
return tf.clipByValue(out, 0, 6)
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|