shenweichen / DeepCTR-Torch

【PyTorch】Easy-to-use,Modular and Extendible package of deep-learning based CTR models.
https://deepctr-torch.readthedocs.io/en/latest/index.html
Apache License 2.0
2.95k stars 696 forks source link

AttributeError: 'Embedding' object has no attribute 'shape' #243

Closed HenryBao91 closed 2 years ago

HenryBao91 commented 2 years ago

Describe the question(问题描述) AttributeError: 'Embedding' object has no attribute 'shape'.

Additional context https://github.com/shenweichen/DeepCTR-Torch/blob/master/deepctr_torch/layers/sequence.py. 代码 57 行和 67 行, uiseq_embed_list 变量的类型为 torch.nn.modules.sparse.Embedding ,uiseq_embed_list 没有 shape 方法, uiseq_embed_list.shape[1] 和 uiseq_embed_list.shape[-1] 报错

Operating environment(运行环境):

zanshuxun commented 2 years ago

请给出复现步骤。

我在python 3.8.13、torch 1.11.0下运行run_din.py(使用了SequencePoolingLayer),没有复现出这个报错 1、run_din.py可以正常跑通 image

2、uiseq_embed_list的类型为torch.Tensor,有shape属性,不会报错 image

image

image

zanshuxun commented 2 years ago

你是运行哪个文件报错的?请给出复现步骤

To Reproduce(复现步骤) Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error