reshape_from_matrix: Turn a matrix into a tensor

View source: R/modeling.R

reshape_from_matrixR Documentation

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

## 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))

## End(Not run)

jonathanbratt/RBERT documentation built on Jan. 26, 2023, 4:15 p.m.