Learn R Programming

RBERT (version 0.1.11)

reshape_from_matrix: Turn a matrix into a tensor

Description

Reshapes a rank 2 tensor back to its original rank >= 2 tensor. The final dimension ('width') of the tensor is assumed to be preserved. If a different width is requested, function will complain.

Usage

reshape_from_matrix(output_tensor, orig_shape_list)

Arguments

output_tensor

Tensor to reshape. What a lousy name for an input.

orig_shape_list

Shape to cast Tensor into.

Value

The Tensor reshaped to rank specified by orig_shape_list.

Examples

Run this code
# NOT RUN {
with(
  tensorflow::tf$variable_scope("examples",
    reuse = tensorflow::tf$AUTO_REUSE
  ),
  r2t <- tensorflow::tf$get_variable("r2t",
    dtype = "int32",
    shape = c(10, 20)
  )
)
reshape_from_matrix(r2t, orig_shape_list = c(5L, 2L, 20L))
# }

Run the code above in your browser using DataLab