Skip to content

Commit 95bf2af

Browse files
authored
Export size via toObject method (#918)
1 parent 09b8a27 commit 95bf2af

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

lib/model/nns/layer/input.js

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default class InputLayer extends Layer {
5656
return {
5757
type: 'input',
5858
name: this._name,
59+
size: this._size?.concat(),
5960
}
6061
}
6162
}

tests/lib/model/nns/layer/input.test.js

+13-4
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,20 @@ describe('layer', () => {
121121
})
122122
})
123123

124-
test('toObject', () => {
125-
const layer = new InputLayer({ name: 'in' })
124+
describe('toObject', () => {
125+
test('name', () => {
126+
const layer = new InputLayer({ name: 'in' })
126127

127-
const obj = layer.toObject()
128-
expect(obj).toEqual({ type: 'input', name: 'in' })
128+
const obj = layer.toObject()
129+
expect(obj).toEqual({ type: 'input', name: 'in' })
130+
})
131+
132+
test('size', () => {
133+
const layer = new InputLayer({ name: 'in', size: [null, 10] })
134+
135+
const obj = layer.toObject()
136+
expect(obj).toEqual({ type: 'input', name: 'in', size: [null, 10] })
137+
})
129138
})
130139

131140
test('fromObject', () => {

0 commit comments

Comments
 (0)