title: How to sum only a portion of a tensor?
body: <p>I want to sum a portion of a tensor from top to bottom, and that portion depends on the value from another tensor. </p>
  
  <p>For example: <code>L = [1,2,3]</code> and <code>I = [2.5]</code></p>
  
  <p>Then I want to get:  <code>1 + 2 + 3*0.5 = 4.5</code></p>
  
  <p>Another example:<code>L = [2,5,8]</code> and <code>I = [1.3]</code></p>
  
  <p>Then I want to get:  <code>2 + 5*0.3 = 3.5</code></p>
  
  <p>What kind of operation is this? Can I do this in <code>tensorflow</code>? ideally without using loops or conditional statement?</p>
  
  <p>I would also like to do this in higher dimensions. </p>
  
  <p>For example: <code>L = [[1,2,3],[2,5,8]]</code> and <code>I = [2.5, 1.3]</code></p>
  
  <p>Then I want to get:  <code>[4.5, 3.5]</code></p>
  
  <p>Any help is much appreciated.</p>