Guest User

Untitled

a guest
May 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. function weight_variable(shape)
  2. initial = map(Float32, rand(Normal(0,0.001), shape...))
  3. return Variable(initial)
  4. end
  5.  
  6. logits = zeros(Float32, (10,1,9,4))
  7.  
  8. weight = weight_variable([10,36,1])
  9. weight = reshape(weight, (36,10))
  10.  
  11. input = reshape([1 2 3 4 5 6 7 8 9 10], (10,1))
  12.  
  13. logits_bis = weight * input
  14. logits_bis = reshape(logits_bis, (9,4))
  15.  
  16. logits = 10×1×9×4 Array{Float32,4}
  17. logits_bis = <Tensor Reshape_5:1 shape=(9, 4) dtype=Float32>
  18.  
  19. logits[1,1,:,:] = 9×4 Array{Float32,2}
  20.  
  21. logits[1,1,:,:] = logits_bis
  22.  
  23. ERROR: MethodError: Cannot `convert` an object of type TensorFlow.Tensor{Float32} to an object of type Float32
  24. This may have arisen from a call to the constructor Float32(...),
  25. since type constructors fall back to convert methods.
Add Comment
Please, Sign In to add comment