Created by: Aurelius84
fluid.embedding
- Check lookup table shape
import paddle.fluid as fluid
input = fluid.data(name="input0", shape=[-1, 1], dtype='int64')
out = fluid.embedding(input, size=(10, 64,49))
before: PaddleCheckError: Expected table_dims.size() == 2, but received table_dims.size():3 != 2:2
after: ShapeError: The dimensions of the 'lookup table' must be 2. But received lookup table's dimensions = 3, lookup table's shape = [10, 64, 49].
fluid.layers.embedding
- Check last dimensions of input shape
import paddle.fluid as fluid
import paddle.fluid.layers as layers
input = fluid.data(name="input0", shape=[-1,3], dtype='int64')
out = layers.embedding(input,size=(10, 64))
before: PaddleCheckError: Expected ids_dims[ids_rank - 1] == 1, but received ids_dims[ids_rank - 1]:3 != 1:1.
after: ShapeError: The last dimensions of the 'Ids' tensor must be 1. But received Ids's last dimensions = 3, Ids's shape = [-1, 3].
- Check lookup table shape
import paddle.fluid as fluid
import paddle.fluid.layers as layers
input = fluid.data(name="input0", shape=[-1, 1], dtype='int64')
out = layers.embedding(input, size=(10, 64,49))
before: PaddleCheckError: Expected table_dims.size() == 2, but received table_dims.size():3 != 2:2
after: ShapeError: The dimensions of the 'lookup table' must be 2. But received lookup table's dimensions = 3, lookup table's shape = [10, 64, 49].