Method ToTensor
ToTensor(Texture, int, int, int)
Converts a texture to a TensorFloat
. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(Texture texture, int width = -1, int height = -1, int channels = -1)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to convert. Must be a Texture2D. |
int | width | The width of the output tensor. If the value is -1, Sentis uses the texture to infer the width. |
int | height | The height of the output tensor. If the value is -1, Sentis uses the texture to infer the height. |
int | channels | The numbers of channels of the output tensor. If the value is -1, Sentis uses the texture to infer the number of channels. |
Returns
Type | Description |
---|---|
TensorFloat | The converted tensor. |
ToTensor(Texture, TextureTransform)
Converts a texture to a TensorFloat
. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(Texture texture, TextureTransform transform)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to convert. Must be a Texture2D. |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
Returns
Type | Description |
---|---|
TensorFloat | The converted tensor. |
ToTensor(Texture, TensorFloat, TextureTransform)
Converts a texture to a TensorFloat
. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static void ToTensor(Texture texture, TensorFloat tensor, TextureTransform transform)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to convert. Must be a Texture2D. |
TensorFloat | tensor | The output tensor. |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
ToTensor(CommandBuffer, Texture, int, int, int)
Appends the conversion of a texture to a TensorFloat
to a CommandBuffer`. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(this CommandBuffer cb, Texture texture, int width = -1, int height = -1, int channels = -1)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
Texture | texture | The texture to convert. Must be a Texture2D. |
int | width | The width of the output tensor. If the value is -1, Sentis uses the texture to infer the width. |
int | height | The height of the output tensor. If the value is -1, Sentis uses the texture to infer the height. |
int | channels | The numbers of channels of the output tensor. If the value is -1, Sentis uses the texture to infer the number of channels. |
Returns
Type | Description |
---|---|
TensorFloat | The converted tensor. |
ToTensor(CommandBuffer, Texture, TextureTransform)
Appends the conversion of a texture to a TensorFloat
to a CommandBuffer. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(this CommandBuffer cb, Texture texture, TextureTransform transform)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
Texture | texture | The texture to convert. Must be a Texture2D. |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
Returns
Type | Description |
---|---|
TensorFloat | The converted tensor. |
ToTensor(CommandBuffer, Texture, TensorFloat, TextureTransform)
Appends the conversion of a texture to a TensorFloat
to a CommandBuffer. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static void ToTensor(this CommandBuffer cb, Texture texture, TensorFloat tensor, TextureTransform transform)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
Texture | texture | The texture to convert. Must be a Texture2D. |
TensorFloat | tensor | The output tensor. |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
ToTensor(CommandBuffer, RenderTargetIdentifier, TextureTransform)
Appends the conversion of a RenderTargetIdentifier to a TensorFloat
to a CommandBuffer. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(this CommandBuffer cb, RenderTargetIdentifier rte, TextureTransform transform = default)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
RenderTargetIdentifier | rte | The RenderTargetIdentifier to convert. |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
Returns
Type | Description |
---|---|
TensorFloat | The converted tensor. |
ToTensor(CommandBuffer, RenderTargetIdentifier, TensorFloat, TextureTransform)
Appends the conversion of a RenderTargetIdentifier to a TensorFloat
to a CommandBuffer. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static void ToTensor(this CommandBuffer cb, RenderTargetIdentifier rte, TensorFloat tensor, TextureTransform transform = default)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
RenderTargetIdentifier | rte | The RenderTargetIdentifier to convert. |
TensorFloat | tensor | The output tensor. |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |