title: Is there any way to convert pytorch tensor to tensorflow tensor
body: <p><a href="https://github.com/taoshen58/BiBloSA/blob/ec67cbdc411278dd29e8888e9fd6451695efc26c/context_fusion/self_attn.py#L29" rel="nofollow noreferrer">https://github.com/taoshen58/BiBloSA/blob/ec67cbdc411278dd29e8888e9fd6451695efc26c/context_fusion/self_attn.py#L29</a></p>
  
  <p>I need to use mulit_dimensional_attention from the above link which is implemented in TensorFlow but I am using PyTorch so can I Convert Pytorch Tensor to TensorFlow Tensor or I have to implement it in PyTorch.</p>
  
  <p>code which I am trying to use here I have to pass 'rep_tensor' as TensorFlow tensor type but I have PyTorch tensor</p>
  
  <pre><code>def multi_dimensional_attention(rep_tensor, rep_mask=None, scope=None,
                                  keep_prob=1., is_train=None, wd=0., activation='elu',
                                  tensor_dict=None, name=None):
  
      # bs, sl, vec = tf.shape(rep_tensor)[0], tf.shape(rep_tensor)[1], tf.shape(rep_tensor)[2]
  
      ivec = rep_tensor.shape[2]
      with tf.variable_scope(scope or 'multi_dimensional_attention'):
          map1 = bn_dense_layer(rep_tensor, ivec, True, 0., 'bn_dense_map1', activation,
                                False, wd, keep_prob, is_train)
          map2 = bn_dense_layer(map1, ivec, True, 0., 'bn_dense_map2', 'linear',
                                False, wd, keep_prob, is_train)
          # map2_masked = exp_mask_for_high_rank(map2, rep_mask)
  
          soft = tf.nn.softmax(map2, 1)  # bs,sl,vec
          attn_output = tf.reduce_sum(soft * rep_tensor, 1)  # bs, vec
  
          # save attn
          if tensor_dict is not None and name is not None:
              tensor_dict[name] = soft
  
          return attn_output
  
  </code></pre>