Allocate StateC.was_split

This commit is contained in:
Matthew Honnibal 2018-04-01 13:44:42 +02:00
parent 728d9841c7
commit 5da7945917

View File

@ -38,6 +38,7 @@ cdef inline int ring_get(RingBufferC* ring, int i) nogil:
cdef cppclass StateC: cdef cppclass StateC:
int* _stack int* _stack
int* _buffer int* _buffer
int* was_split
bint* shifted bint* shifted
TokenC* _sent TokenC* _sent
Entity* _ents Entity* _ents
@ -56,6 +57,7 @@ cdef cppclass StateC:
cdef int PADDING = 5 cdef int PADDING = 5
this._buffer = <int*>calloc(length + (PADDING * 2), sizeof(int)) this._buffer = <int*>calloc(length + (PADDING * 2), sizeof(int))
this._stack = <int*>calloc(length + (PADDING * 2), sizeof(int)) this._stack = <int*>calloc(length + (PADDING * 2), sizeof(int))
this.was_split = <int*>calloc(length + (PADDING * 2), sizeof(int))
this.shifted = <bint*>calloc(length + (PADDING * 2), sizeof(bint)) this.shifted = <bint*>calloc(length + (PADDING * 2), sizeof(bint))
this._sent = <TokenC*>calloc(length + (PADDING * 2), sizeof(TokenC)) this._sent = <TokenC*>calloc(length + (PADDING * 2), sizeof(TokenC))
this._ents = <Entity*>calloc(length + (PADDING * 2), sizeof(Entity)) this._ents = <Entity*>calloc(length + (PADDING * 2), sizeof(Entity))
@ -102,6 +104,7 @@ cdef cppclass StateC:
free(this._buffer - PADDING) free(this._buffer - PADDING)
free(this._stack - PADDING) free(this._stack - PADDING)
free(this.shifted - PADDING) free(this.shifted - PADDING)
free(this.was_split)
void set_context_tokens(int* ids, int n) nogil: void set_context_tokens(int* ids, int n) nogil:
if n == 2: if n == 2: