Git Product home page Git Product logo

beam_search's Introduction

beam_search

beam_search 算法python 版本,便于在pytorch中进行更改,优点是可以使用batch_size=1,对于复杂架构的input格式不用repeat数据

随后会增加一个pytorch版本的:

该写法的优点在于,整体的batch_size都是1,对于复杂的input数据格式类型做beam_search的时候不用去repeat复杂的数据结构。
讲一下心灵历程: 本科硕士一直都是调库工程师,开始做算法的时候非常讨厌刷了几个月leecode,不太理解算法岗位明明一个函数就能解决的问题为什么要考那么细节,面试让重复刷leecode。
甚至读博开始时期非常讨厌面试leecode试题。认为这是浪费时间,等做到了博士第三年,自己发paper原创程度越来越大,反而意识到了leecode,动态规划中维特比,树状结构等知识的重要性。
如果是在本科阶段看到该代码的同学,将来有志成为算法工程师的,真心多刷刷leecode,数据结构,算法一定要往复练习,至于像我,博士第三年了,所有知识都是一只半懂,修修改改,甚至最简单的完整的Pytorch-seq2seq-Beam-Search都不能保证手写的出来,完全手写出来里面的每个知识点。
学习方法分两种,一种是快速学习框架,填充知识。一种是深入细节精雕细琢。 做算法需要前者,更需要后者,这对调库工程师而言,虽然快速掌握框架,大体知识体系囫囵吞枣的学完是一种没错的方法,对于很多知识其实是花大量时间后,以后压根用不到的。但是在算法研究的后期一定是一个需要转化心态的过程,要能放慢心态开始精雕细琢。有个华为老员工十几年前说的一句话,所谓行业天才往往只是在常人看到一个缝的地方看到了一个世界。最近一年慢慢懂了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.