Paddle Embedding问题

piztneat  于 2022-10-20  发布在  其他
关注(0)|答案(4)|浏览(113)

code:

from paddle import nn
import numpy as np
import paddle

embedding = nn.Embedding(100, 200)

x = np.array([[4, 1, 4, 10000, 3, 9, 900, 1, 1, 5],
              [8, 6, 5, 8000, 2, 7, 3, 1, 1, 6]])
input_paddle = paddle.to_tensor(x, dtype='int64')

output = embedding(input_paddle)
print(output)

console:

Tensor(shape=[2, 10, 200], dtype=float32, place=CUDAPlace(0), stop_gradient=False,
       [[[ 0.07328835, -0.09469348,  0.07219494, ...,  0.01943331,
          -0.12398233, -0.08197384],
         [-0.08139029, -0.10521033,  0.11584321, ..., -0.03910951,
           0.12038675, -0.09803125],
         [ 0.07328835, -0.09469348,  0.07219494, ...,  0.01943331,
          -0.12398233, -0.08197384],
         ...,
         [-0.08139029, -0.10521033,  0.11584321, ..., -0.03910951,
           0.12038675, -0.09803125],
         [-0.08139029, -0.10521033,  0.11584321, ..., -0.03910951,
           0.12038675, -0.09803125],
         [ 0.01028429,  0.04357532, -0.07706941, ...,  0.07706572,
           0.09165546,  0.07484353]],
        [[ 0.08599947, -0.00237131,  0.08609001, ..., -0.00191966,
           0.10842200, -0.08339714],
         [ 0.02185206,  0.10013362,  0.05010634, ...,  0.00987017,
           0.13578133, -0.01342258],
         [ 0.01028429,  0.04357532, -0.07706941, ...,  0.07706572,
           0.09165546,  0.07484353],
         ...,
         [-0.08139029, -0.10521033,  0.11584321, ..., -0.03910951,
           0.12038675, -0.09803125],
         [-0.08139029, -0.10521033,  0.11584321, ..., -0.03910951,
           0.12038675, -0.09803125],
         [ 0.02185206,  0.10013362,  0.05010634, ...,  0.00987017,
           0.13578133, -0.01342258]]])

paddle:2.2.1

我embedding的大小只有100
为什么输入10000, 900, 800000却不会报错

8iwquhpp

8iwquhpp1#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档常见问题历史IssueAI社区 来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

46scxncf

46scxncf2#

请@Yanxing-Shi 协助回答下

xxslljrj

xxslljrj4#

@jyjfjyjf 正在排查原因,解决后给您回复~

相关问题