deepjavalibrary / djl-demo

Demo applications showcasing DJL
https://demo.djl.ai
Apache License 2.0
307 stars 127 forks source link

MXNet engine call failed: MXNetError: Check failed: dshp.ndim() == 3U (2 vs. 3) : Input data should be 3D in batch-num_filter-x #466

Open thesardorbroo opened 3 months ago

thesardorbroo commented 3 months ago

Hi every one. I am learning DJL(Deep java library) and I have seen Malicious URL Detector post and I'm going to try it locally, but when I run the code I get error. image

I have tried to remove FEATURE_LENGTH but got another error: image

I want to solve the problem but I don't know how to do it( And I have some questions about source code of Malicious URL Detector line 71 and SequentialBlocks.

  1. Why we initialize 3D shape? in csv data only 2 column(first feature and second is label)
  2. Why we need a lot of blocks? What does it mean acctually? source code
zachgk commented 3 months ago
  1. We use a 3D shape because most operations work no on single CSV data items, but batches of CSV data items. So the reference to NCW for the expected layout is using the common names for the axes: n for batch size, c for channels (bytes per character) and w for width (number of characters).
  2. Each block is a trainable function used in deep learning. They have state in terms of parameters and possibly child blocks, and use them to compute the result given the input.

You can find more basics for getting into deep learning from our Dive into Deep Learning Book