paddle數據Tensor


1.根據輸入數據構建loader

  

src = fluid.data(name="src", shape=[None, None], dtype="int64")
    src_sequence_length = fluid.data(name="src_sequence_length",shape=[None],dtype="int64")
    inputs = [src, src_sequence_length]
loader = fluid.io.DataLoader.from_generator(feed_list=inputs,capacity=10,
                                                iterable=True,use_double_buffer=True)

loader.set_batch_generator(reader,places=places)

 

之后loader會將輸入的Tensor自動轉化為輸入需要的lodTensor

 

2.program

train_prog = fluid.Program()
startup_prog = fluid.Program()
with fluid.program_guard(train_prog, startup_prog):
    with fluid.unique_name.guard():
        pass

默認情況下網絡是在default_main_program中,如果要自定義program必須使用with結構


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM